| Author |
Serialization without creating the file
|
Ismael Upright
Ranch Hand
Joined: Feb 15, 2007
Posts: 166
|
|
Hello, Is is possible to serialize and deserialize an object without physically creating the file on the disk? I mean keeping everything in the memory?
|
 |
Rob Spoor
Sheriff
Joined: Oct 27, 2005
Posts: 19216
|
|
|
Sure. ObjectOutputStream can use any OutputStream to write to. If you use ByteArrayOutputStream you can at the end retrieve the byte array with the contents. You pass that into a new ByteArrayInputStream with which you create an ObjectInputStream.
|
SCJP 1.4 - SCJP 6 - SCWCD 5
How To Ask Questions How To Answer Questions
|
 |
Ismael Upright
Ranch Hand
Joined: Feb 15, 2007
Posts: 166
|
|
Thanks I also found that tip on another forum http://www.devx.com/tips/Tip/13341
|
 |
 |
|
|
subject: Serialization without creating the file
|
|
|