Class Unarchiver
All Packages Class Hierarchy This Package Previous Next Index
Class Unarchiver
public class netscape.util.Unarchiver
extends java.lang.Object
implements netscape.util.Decoder
{
/* Constructors
*/
public Unarchiver(Archive);
/* Methods
*/
public static Object readObject(InputStream);
public Archive archive();
protected Class classForName(String);
public boolean decodeBoolean(String);
public boolean[] decodeBooleanArray(String);
public byte decodeByte(String);
public byte[] decodeByteArray(String);
public char decodeChar(String);
public char[] decodeCharArray(String);
public double decodeDouble(String);
public double[] decodeDoubleArray(String);
public float decodeFloat(String);
public float[] decodeFloatArray(String);
public int decodeInt(String);
public int[] decodeIntArray(String);
public long decodeLong(String);
public long[] decodeLongArray(String);
public Object decodeObject(String);
public Object[] decodeObjectArray(String);
public short decodeShort(String);
public short[] decodeShortArray(String);
public String decodeString(String);
public String[] decodeStringArray(String);
public void replaceObject(Object);
public Object unarchiveIdentifier(int);
public int versionForClassName(String);
}
Object subclass implementing the Decoder interface to decode a graph of
objects from an Archive. The following example demonstrates how to use
an Unarchiver to retrieve the first root object from an Archive read from
System.in:
archive = new Archive();
archive.readASCII(System.in)
rootIdentifiers = archive.rootIdentifiers();
unarchiver = new Unarchiver(archive);
rootObject = unarchiver.unarchiveIdentifier(rootIdentifiers[0]);
- See Also:
- Decoder, Archive, Archiver
Constructors
.Unarchiver
public Unarchiver(Archive archive)
- Primitive constructor creating an Unarchiver that retrieves objects
from archive. Do not mutate the Archive while using the
Unarchiver.
Methods
public Archive archive()
- Returns the archive from which the Unarchiver decodes objects.
public static Object readObject(java.io.InputStream inputStream) throws IOException, CodingException
- A convenience method for reading an object from a stream.
Equivilent to the code:
archive = new Archive();
archive.read(in);
unarchiver = new Unarchiver(archive);
rootIds = archive.rootIdentifiers();
if (rootIds == null || rootIds.length == 0)
return null;
return unarchiver.unarchiveIdentifier(rootIds[0]);
public Object unarchiveIdentifier(int identifier) throws CodingException
- Unarchives a graph of objects starting from the object identified by
identifier in an archive. That object, and all objects it
references, will be reconstructed by calling their empty constructor
followed by decode().
- See Also:
- rootIdentifiers, Codable, Decoder
protected Class classForName(String className) throws CodingException
- Called to look up a class from the Archive by name.
public int versionForClassName(String className) throws CodingException
- Decoder interface method that returns the version information for the
class named className. Objects can use this information to
bring forward old encodings at runtime.
public boolean decodeBoolean(String key) throws CodingException
- Decoder interface method that decodes the boolean value associated
with the string key.
public boolean[] decodeBooleanArray(String key) throws CodingException
- Decoder interface method that decodes the boolean array associated
with the string key.
public char decodeChar(String key) throws CodingException
- Decoder interface method that decodes the character value associated
with the string key.
public char[] decodeCharArray(String key) throws CodingException
- Decoder interface method that decodes the character array associated
with the string key.
public byte decodeByte(String key) throws CodingException
- Decoder interface method that decodes the byte value associated with
the string key.
public byte[] decodeByteArray(String key) throws CodingException
- Decoder interface method that decodes the byte array associated with
the string key.
public short decodeShort(String key) throws CodingException
- Decoder interface method that decodes the short value associated with
the string key.
public short[] decodeShortArray(String key) throws CodingException
- Decoder interface method that decodes the short array associated with
the string key.
public int decodeInt(String key) throws CodingException
- Decoder interface method that decodes the integer value associated
with the string key.
public int[] decodeIntArray(String key) throws CodingException
- Decoder interface method that decodes the integer array associated
with the string key.
public long decodeLong(String key) throws CodingException
- Decoder interface method that decodes the long value associated with
the string key.
public long[] decodeLongArray(String key) throws CodingException
- Decoder interface method that decodes the long array value associated
with the string key.
public float decodeFloat(String key) throws CodingException
- Decoder interface method that decodes the float value associated with
the string key.
public float[] decodeFloatArray(String key) throws CodingException
- Decoder interface method that decodes the float array associated with
the string key.
public double decodeDouble(String key) throws CodingException
- Decoder interface method that decodes the double value associated with
the string key.
public double[] decodeDoubleArray(String key) throws CodingException
- Decoder interface method that decodes the double array associated with
the string key.
public String decodeString(String key) throws CodingException
- Decoder interface method that decodes the string value associated with
the string key.
public String[] decodeStringArray(String key) throws CodingException
- Decoder interface method that decodes the string array associated with
the string key.
public Object decodeObject(String key) throws CodingException
- Decoder interface method that decodes a reference to another Codable
object.
public Object[] decodeObjectArray(String key) throws CodingException
- Decoder interface method that decodes an array of Codable objects. The
references to the Codable objects are shared, but the reference to the
array is not.
public void replaceObject(Object replacement) throws CodingException
- Decoder interface method that replaces references to the object
currently being decoded with replacement. This method throws a
CodingException when an attempt is made to replace an object which has
already been seen by other objects. For maximum safety, this method
should only be called from leaves of the object graph.
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