Class Serializer
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class Serializer

public class netscape.util.Serializer
    extends java.io.FilterOutputStream
{
    /* Constructors
     */
    public Serializer(OutputStream);

    /* Methods
     */
    public static String serializeObject(Object);
    public static boolean writeObject(OutputStream, Object);

    public void flush();
    public void writeObject(Object);
}
Object subclass that can serialize a fixed set of data types (Dictionaries, arrays, Vectors, and Strings) to an ASCII stream. If the object passed in is not one of these types, or contains an object that is not one of these types, the Serializer converts the object to a string via the object's toString() method. The serialization format is very similar to the output of Hashtable's and Vector's toString() methods, except that strings with non-alphanumeric characters are quoted and special characters are escaped, so that the output can be unambiguously deserialized. Serializer produces an ASCII representation with few, if any, spaces separating components. To get a more readable representation, use the OutputSerializer class.
See Also:
Deserializer, OutputSerializer

Constructors

Serializer

  public Serializer(OutputStream outputStream)
Constructs a Serializer that writes its output to outputStream.

Methods

flush

  public void flush() throws IOException
Flushes the Serializer's output to its stream.
Overrides:
flush in class FilterOutputStream

writeObject

  public void writeObject(Object anObject) throws IOException
Serializes anObject to its stream.

serializeObject

  public static String serializeObject(Object anObject)
Convenience method for generating anObject's ASCII serialization. Returns null on error.

writeObject

  public static boolean writeObject(OutputStream outputStream,
                                    Object anObject)
Convenience method for writing anObjectoutputStream. Returns true if the serialization and writing succeeds, rather than throwing an exception.

All Packages  Class Hierarchy  This Package  Previous  Next  Index