I'm new to Java.io.Serializable
, so my apologies if this is a completely newb question. What I'd like to do is implement readObject()
and writeObject()
such that the absolute minimum of data is serialized. I'd basically like to only write a few primitives and no information about object identity and no information about the Object graph, as in my application I'll know all that information at the time I deserialize this object.
I hope this makes sense! I do apologize for the high-level nature of the question as I'm quite new at this and may not have the correct vocabulary here.
You can use transient
word for declaring fields so they won't be serialized.
Then you won't have to implement read/writeObject youself - it will serialize only what you want to be serialized.
More on this here: http://www.javabeat.net/examples/2009/02/18/what-is-transient-keyword-in-java/