ObjectStreams - Java ME Serialization and Persistence
IntroductionJ2ME does not support the idea of a Serializable interface. Consequently there are no ObjectInputStream and ObjectOutputStream classes. The absence of these classes can make it tedious to serialize objects between a J2ME client and Java servlet. Additionally, persisting objects in the RecordStore (RMS) is made somewhat tricky. ObjectStreams is a library that provides some support for serializing and persisting objects.
There are many other serialization and persistence libraries. In particular, you should consider using J2ME Polish before selecting ObjectStreams.
ObjectStreamsObjectStreams provides a SerializableInputStream and a SerializableOutputStream class that expose readObject and writeObject methods respectively. For a class to be serializable, a Marshaller interface must have been implemented for the class. ObjectStreams includes marshallers for the String, Vector, Hashtable, Date classes, for primitive arrays and for other classes.
The RMS can be tedious to use. To simplify using the RMS, ObjectStreams supplies a Persistence class that extends Hashtable. The put and get methods are used for storing objects in the Hashtable. All the other methods of Hashtable are also overridden; for example, keys returns an enumeration of the table's keys.