• Post Reply Bookmark Topic Watch Topic
  • New Topic

Serialization without creating the file  RSS feed

 
Ismael Upright
Ranch Hand
Posts: 166
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 21135
87
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Ismael Upright
Ranch Hand
Posts: 166
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks I also found that tip on another forum

http://www.devx.com/tips/Tip/13341
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!