Comparing structures
Hello,
Does anyone know; if two separate structures with the same data were serialized, could the serialized stream of each structure be compared, to see if they are the same? For example take the head of each stream and compare them, if all bits of the serialized stream match then the structures are the same. If one bit doesn't match then they are not the same.
I have asked three of my teachers and they don't know
I would try it out however got a dissertation due in a week.
Thank you
[522 byte] By [
topcata] at [2007-10-2 15:12:08]

> I have asked three of my teachers and they don't
> know
Did you ask you poetry teacher?
> I would try it out however got a dissertation due in
> a week.
Testing this doesn't take a week. Just write two classes like this:
import java.io.*;
public class AnObject implements Serializable {
private String data;
public AnotherObject(String d) {
data = d;
}
// ...
}
///////////////////////////////////
import java.io.*;
public class AnotherObject implements Serializable {
private String data;
public AnotherObject(String d) {
data = d;
}
// ...
}
And serialize AnObject to disc and try deserializing it as an AnotherObject .
Here's a demo how to serialize an object: http://javaalmanac.com/egs/java.io/SerializeObj.html
Good luck.