472,126 Members | 1,591 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,126 software developers and data experts.

Forcing re-serialization of a serialized object?


The result of auto-converting some Java code to C# yielded
the following upgrade issue regarding the original Java
call to "reset()":

public virtual void writeObj(Object obj)
BinaryFormatter formatter = new BinaryFormatter();
formatter.Serialize(thisStream, obj);

Method 'java.io.ObjectOutputStream.reset' was not
converted. 'ms-


At the bottom of this posting I have copied what the
Microsoft help on this issue provided. While I understand
what the problem is (that already serialized objects won't
be reserialized), I don't understand what they're saying
to do to correct the error. I looked at their two
solutions but didn't have a clue what the words meant. Is
there a simple way to force reserialization of the same

Ray Mitchell
******FROM Microsoft's help link:

In Visual J++, this method sets the state of the
ObjectOutputStream object to the same state as when it was
created. As objects are serialized to the stream, the
ObjectOutputStream remembers which ones are already
serialized. If the program requests that already
serialized objects be written again, ObjectOutputStream
writes a reference to the previous object. Calling this
method causes ObjectOutputStream to serialize all
subsequent objects fully.

In the .NET Framework, there is no direct equivalent.

To correct this error

Use the
System.Runtime.Serialization.Formatters.BinaryForm atter.Bin
der property or the BinaryFormatter.Context property with
the source and destination of a serialized stream.
Nov 15 '05 #1
0 1215

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Hugh Lutley | last post: by
reply views Thread by Robert Wille | last post: by
1 post views Thread by Robert Wille | last post: by
12 posts views Thread by Howard Kaikow | last post: by
reply views Thread by steve | last post: by
4 posts views Thread by ATS16805 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.