This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Byte arrays to save serialized objects? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Byte arrays to save serialized objects?" Watch "Byte arrays to save serialized objects?" New topic
Author

Byte arrays to save serialized objects?

Jon Camilleri
Ranch Hand

Joined: Apr 25, 2008
Posts: 659

"The Preferences repository has a tree structure, with node path names such as /com/mycom-
pany/myapp. As with package names, name clashes are avoided as long as programmers
start the paths with reversed domain names. In fact, the designers of the API suggest
that the configuration node paths match the package names in your program.
Each node in the repository has a separate table of key/value pairs that you can use to
store numbers, strings, or byte arrays. No provision is made for storing serializable
objects.

The API designers felt that the serialization format is too fragile for long-term
storage. Of course, if you disagree, you can save serialized objects in byte arrays."

Core Java Volume I (8th Edition) P.544

Does anyone have an example of using byte arrays to save serialized objects?

Jon
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18108
    
  39

Jon Camilleri wrote:
Does anyone have an example of using byte arrays to save serialized objects?


It's actually fairly easy to figure out on your own.

Serialization is done with the ObjectOutputStream and ObjectInputStream classes. These classes take OutputStream and InputStream respectively. And there are byte array versions of this stream.

Henry


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Byte arrays to save serialized objects?
 
Similar Threads
Object Serialization and Deserialization
what is mean by Marker interface?
can we send swing component to server
Does an array implements Serializable automatically ?
Time to revisit the primitive immutable wrapper objects in the java.lang package?