Class Archiver
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class Archiver

public class netscape.util.Archiver
    extends java.lang.Object
    implements netscape.util.Encoder
{
    /* Constructors
     */
    public Archiver(Archive);

    /* Methods
     */
    public static void writeObject(OutputStream, Object);

    public Archive archive();
    public void archiveRootObject(Object);
    public void encodeBoolean(String, boolean);
    public void encodeBooleanArray(String, boolean[], int, int);
    public void encodeByte(String, byte);
    public void encodeByteArray(String, byte[], int, int);
    public void encodeChar(String, char);
    public void encodeCharArray(String, char[], int, int);
    public void encodeDouble(String, double);
    public void encodeDoubleArray(String, double[], int, int);
    public void encodeFloat(String, float);
    public void encodeFloatArray(String, float[], int, int);
    public void encodeInt(String, int);
    public void encodeIntArray(String, int[], int, int);
    public void encodeLong(String, long);
    public void encodeLongArray(String, long[], int, int);
    public void encodeObject(String, Object);
    public void encodeObjectArray(String, Object[], int, int);
    public void encodeShort(String, short);
    public void encodeShortArray(String, short[], int, int);
    public void encodeString(String, String);
    public void encodeStringArray(String, String[], int, int);
}
Object subclass implementing the Encoder interface to encode a graph of objects to an Archive. The following example demonstrates how to use an Archiver to write a graph of objects, starting from rootObject to the stream System.out:
   archiver = new Archiver(new Archive());
   archiver.archiveRootObject(rootObject);
   archiver.archive().writeASCII(System.out, true);
See Also:
Encoder, Archive

Constructors

Archiver

  public Archiver(Archive archive)
Constructs an Archiver that writes to archive.

Methods

archive

  public Archive archive()
Returns the archive used by the Archiver.

writeObject

  public static void writeObject(OutputStream outputStream,
                                 Object root) throws IOException, CodingException
A convenience method for writing an object to a stream. Equivilent to:
   archive = new Archive();
   archiver = new Archiver(archive);
   archiver.archiveRootObject(root);
   archive.write(out);

archiveRootObject

  public void archiveRootObject(Object root) throws CodingException
Starts the archiving process. This method can be called multiple times to encode more than one graph (which may or may not overlap) into an Archive. This automatically adds the object to the Archive's array of root identifiers.

encodeBoolean

  public void encodeBoolean(String key,
                            boolean value) throws CodingException
Encoder interface method that encodes the boolean value, associating it with the string key.

encodeBooleanArray

  public void encodeBooleanArray(String key,
                                 boolean value[],
                                 int offset,
                                 int length) throws CodingException
Encoder interface method that encodes the boolean array value, associating it with the string key.

encodeChar

  public void encodeChar(String key,
                         char value) throws CodingException
Encoder interface method that encodes the character value, associating it with the string key.

encodeCharArray

  public void encodeCharArray(String key,
                              char value[],
                              int offset,
                              int length) throws CodingException
Encoder interface method that encodes the character array value, associating it with the string key.

encodeByte

  public void encodeByte(String key,
                         byte value) throws CodingException
Encoder interface method that encodes the byte value, associating it with the string key.

encodeByteArray

  public void encodeByteArray(String key,
                              byte value[],
                              int offset,
                              int length) throws CodingException
Encoder interface method that encodes the byte array value, associating it with the string key.

encodeShort

  public void encodeShort(String key,
                          short value) throws CodingException
Encoder interface method that encodes the short value, associating it with the string key.

encodeShortArray

  public void encodeShortArray(String key,
                               short value[],
                               int offset,
                               int length) throws CodingException
Encoder interface method that encodes the short array value, associating it with the string key.

encodeInt

  public void encodeInt(String key,
                        int value) throws CodingException
Encoder interface method that encodes the integer value, associating it with the string key.

encodeIntArray

  public void encodeIntArray(String key,
                             int value[],
                             int offset,
                             int length) throws CodingException
Encoder interface method that encodes the integer array value, associating it with the string key.

encodeLong

  public void encodeLong(String key,
                         long value) throws CodingException
Encoder interface method that encodes the long value, associating it with the string key.

encodeLongArray

  public void encodeLongArray(String key,
                              long value[],
                              int offset,
                              int length) throws CodingException
Encoder interface method that encodes the long array value, associating it with the string key.

encodeFloat

  public void encodeFloat(String key,
                          float value) throws CodingException
Encoder interface method that encodes the float value, associating it with the string key.

encodeFloatArray

  public void encodeFloatArray(String key,
                               float value[],
                               int offset,
                               int length) throws CodingException
Encoder interface method that encodes the float array value, associating it with the string key.

encodeDouble

  public void encodeDouble(String key,
                           double value) throws CodingException
Encoder interface method that encodes the double value, associating it with the string key.

encodeDoubleArray

  public void encodeDoubleArray(String key,
                                double value[],
                                int offset,
                                int length) throws CodingException
Encoder interface method that encodes the double array value, associating it with the string key.

encodeString

  public void encodeString(String key,
                           String value) throws CodingException
Encoder interface method that encodes the string value, associating it with the string key.

encodeStringArray

  public void encodeStringArray(String key,
                                String value[],
                                int offset,
                                int length) throws CodingException
Encoder interface method that encodes the string array value, associating it with the string key.

encodeObject

  public void encodeObject(String key,
                           Object value) throws CodingException
Encoder interface method that encodes a reference to another Codable object. If multiple objects reference the same object and each passes it to encodeObject(), only one copy of that object is actually encoded.

encodeObjectArray

  public void encodeObjectArray(String key,
                                Object value[],
                                int offset,
                                int length) throws CodingException
Encoder interface method that encodes an array of Codable objects. The reference to the array is not shared, but references to the objects in the array are.

All Packages  Class Hierarchy  This Package  Previous  Next  Index