aspose file tools
The moose likes Java in General and the fly likes Serialization without creating the file Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "Serialization without creating the file" Watch "Serialization without creating the file" New topic
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
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: Serialization without creating the file
 
Similar Threads
IBM Websphere 6.0
Displaying file content in JSF
Retrieving ByteArray from encrypted zip file
Need help in reading a file stored as a blob in database
jar and manifest problem