Class Archive
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class Archive

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

    /* Methods
     */
    public void addClassTable(ClassTable);
    public void addRootIdentifier(int);
    public ClassTable classTableForIdentifier(int);
    public ClassTable classTableForName(String);
    public int identifierCount();
    public int mapIdentifier(ClassTable, int);
    public void read(InputStream);
    public void readASCII(InputStream);
    public boolean removeRootIdentifier(int);
    public int[] rootIdentifiers();
    public int rowForIdentifier(int);
    public void write(OutputStream);
    public void writeASCII(OutputStream, boolean);
}
Object subclass used by the Archiver and Unarchiver to store the encoded state of Codable objects. Archives contain a collection of ClassTables and a mapping of object identifiers to a row in a specific ClassTable. Each ClassTable row corresponds to an encoded object. References between objects are encoded as opaque integers (identifiers). The archive also maintains a set of root identifiers from which all objects in the archive can be reached. Most programs will not need to deal directly with the Archive class, but instead will work with Archivers and Unarchivers.
See Also:
ClassTable, Archiver, Unarchiver

Constructors

Archive

  public Archive()
Constructs a new, empty Archive.

Methods

addRootIdentifier

  public void addRootIdentifier(int id)
Adds an identifier to the array of root identifiers. The identifier must be created by calling newIdentifier() on a ClassTable.
See Also:
newIdentifier

removeRootIdentifier

  public boolean removeRootIdentifier(int id)
Removes an identifier from the array of root identifiers. Returns true if the identifier was in the array, false if it was not.
See Also:
addRootIdentifier

rootIdentifiers

  public int[] rootIdentifiers()
Returns a copy of the root identifier array.

classTableForName

  public ClassTable classTableForName(String className)
Returns the ClassTable for a given class name.

addClassTable

  public void addClassTable(ClassTable table)
Adds a new ClassTable to the archive. This should be called after creating a new ClassTable.
See Also:
ClassTable

classTableForIdentifier

  public ClassTable classTableForIdentifier(int id)
Returns the ClassTable for a given object identifier in the archive.
See Also:
ClassTable

rowForIdentifier

  public int rowForIdentifier(int id)
Returns the row for a given object identifier in the archive.
See Also:
ClassTable

mapIdentifier

  public int mapIdentifier(ClassTable table,
                           int row)
Primitive method for mapping a ClassTable and row to a new object identifier. Most programs will simply call ClassTable.newIdentifier() to get a new object identifier.
See Also:
newIdentifier

identifierCount

  public int identifierCount()
Returns the number of object identifiers in the archive. All identifiers will be between 0 and (identifierCount() - 1), inclusive.

read

  public void read(InputStream inputStream) throws IOException
Reads a binary serialization of the Archive's contents from inputStream.
See Also:
readObject

write

  public void write(OutputStream outputStream) throws IOException
Writes a binary serialization of the Archive's contents to outputStream.
See Also:
writeObject

readASCII

  public void readASCII(InputStream inputStream) throws CodingException, DeserializationException, IOException
Reads an ASCII serialization of the Archive's contents from inputStream.
See Also:
Serializer, Deserializer

writeASCII

  public void writeASCII(OutputStream outputStream,
                         boolean formatted) throws CodingException, IOException
Writes an ASCII serialization of the Archive's contents to outputStream. If formatted is true, the Archive formats the output for easy reading. If false, the output will be as compact as possible.
See Also:
Serializer, Deserializer

All Packages  Class Hierarchy  This Package  Previous  Next  Index