~/ learn/ comp-308/ cards/ Serialization & deserialization
1 of 7

Serialize an object to a file

Serialize an object to a file

Answer

ObjectOutputStream out = new ObjectOutputStream( new FileOutputStream("dump.out")); out.writeObject(gc);

ObjectOutputStream wraps a byte sink (FileOutputStream); writeObject(gc) serializes gc and its whole object graph to dump.out.

space flip · ← → navigate · esc to exit
NORMAL ~/memra/library/e7932c93-b1e8-4e8f-8704-ad687296b92b/flashcard utf-8 LF