0

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.

M A
  • 71,713
  • 13
  • 134
  • 174
Carl Veazey
  • 18,392
  • 8
  • 66
  • 81

1 Answers1

1

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/

Eugene Retunsky
  • 13,009
  • 4
  • 52
  • 55
  • Eugene, thanks for your answer. I haven't had a chance to review it just yet but will take a look tonight and see if this resolves the problem. – Carl Veazey Apr 19 '12 at 21:27