Can I wrote an object to files and later on retrieves it with its integrety intact? Is there a ready made function or do I have to write one?

I am new to Java, is this what one calls serialization?

Recommended Answers

All 4 Replies

yes, that's serialization.
It works if you take some basic precautions (like making sure every field in your class is itself Serializable or transient).

Of course you should mark things that rely on external data as being transient so they don't get serialized as those external resources likely will not exist or be different when you deserialize it again.

Thank yo so much! I need to study this more.

Hi everyone,

Soory to go off topic for a while but i saw you avatar its the firebird. Any relation to janus software?

Richard West

Try using ObjectInputStream and ObjectOutputStream.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.