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
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
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
public int[] rootIdentifiers()
- Returns a copy of the root identifier array.
public ClassTable classTableForName(String className)
- Returns the ClassTable for a given class name.
public void addClassTable(ClassTable table)
- Adds a new ClassTable to the archive. This should be called after
creating a new ClassTable.
- See Also:
- ClassTable
public ClassTable classTableForIdentifier(int id)
- Returns the ClassTable for a given object identifier in the archive.
- See Also:
- ClassTable
public int rowForIdentifier(int id)
- Returns the row for a given object identifier in the archive.
- See Also:
- ClassTable
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
public int identifierCount()
- Returns the number of object identifiers in the archive. All
identifiers will be between 0 and (identifierCount() - 1), inclusive.
public void read(java.io.InputStream inputStream) throws IOException
- Reads a binary serialization of the Archive's contents from
inputStream.
- See Also:
- readObject
public void write(java.io.OutputStream outputStream) throws IOException
- Writes a binary serialization of the Archive's contents to
outputStream.
- See Also:
- writeObject
public void readASCII(java.io.InputStream inputStream) throws CodingException, DeserializationException, IOException
- Reads an ASCII serialization of the Archive's contents from
inputStream.
- See Also:
- Serializer, Deserializer
public void writeASCII(java.io.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
Copyright © 1997 Netscape Communications Corporation. All rights reserved
Please send any comments or corrections to ifcfeedback@netscape.com
HTML generated on 21 Oct 1997