Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Rice Pastry API
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## rice.p2p.util
Class XMLObjectInputStream

    java.lang.Object
      java.io.InputStream
          java.io.ObjectInputStream
              rice.p2p.util.XMLObjectInputStream

All Implemented Interfaces:
  java.io.DataInput, java.io.ObjectInput, java.io.ObjectStreamConstants

public class XMLObjectInputStream
extends java.io.ObjectInputStream

XMLObjectInputStreamm is an extension of ObjectInputStreamm which provides for deserialization for objects which have been converted to XML via a XMLObjectOutputStream. This class supports all of the features of the ObjectInputStreamm, including serialization support for any Java object graph implementing the Serializable interface, support for Externalizable classes, custom deserialization via the readObject() method, class evolution via the readObjectNoData() method, alternate field reading mechanisms via the readFields() method, support for the readUnshared method, and dynamic object replacement via the readResolve() method. The format of the XML data to be read in should conform to the JSX XML Schema, available online at http://www.jsx.org/jsx.xsd. This class is designed to be able to read objects serialized using JSX, however, this has not been fully tested and bugs may be encountered.

Version:
  $Id: XMLObjectInputStream.java 2556 2005-06-07 22:02:14Z jeffh $
Author:
  Alan Mislove

Nested Class Summary
`class` | `XMLObjectInputStream.GetField` This class is an implementation of GetField which is compatible with the XMLObjectInputStreamm.

Field Summary
`protected static SoftHashMap` | `CONSTRUCTORS` A cache of constructors, mapping classes to serialization constructors
`protected java.util.Stack` | `currentClasses` The stack of class types which are being read off of the stream
`protected java.util.Stack` | `currentObjects` The stack of objects which are currently being read off of the stream
`protected int` | `depth` The depth at which we are currently at in the object tree
`protected static SoftHashMap` | `READ_OBJECTS` The hashmap of readObject methods, mapping Class->Method
`protected static SoftHashMap` | `READ_RESOLVES` The hashmap of readResolve methods, mapping Class->Method
`protected XMLReader` | `reader` The underlying reader, which parses the XML
`protected java.util.Hashtable` | `references` The hashtable of references, which is updated each time a new object is read off of the stream.
`protected sun.reflect.ReflectionFactory` | `reflFactory` The ReflectionFactory, which allows for prividged construction of objects
`protected rice.p2p.util.XMLObjectInputStream.ValidationList` | `vlist` The list of validation objects waiting for the entire object graph to be read in

Fields inherited from interface java.io.ObjectStreamConstants
`baseWireHandle, PROTOCOL_VERSION_1, PROTOCOL_VERSION_2, SC_BLOCK_DATA, SC_EXTERNALIZABLE, SC_SERIALIZABLE, SC_WRITE_METHOD, STREAM_MAGIC, STREAM_VERSION, SUBCLASS_IMPLEMENTATION_PERMISSION, SUBSTITUTION_PERMISSION, TC_ARRAY, TC_BASE, TC_BLOCKDATA, TC_BLOCKDATALONG, TC_CLASS, TC_CLASSDESC, TC_ENDBLOCKDATA, TC_EXCEPTION, TC_LONGSTRING, TC_MAX, TC_NULL, TC_OBJECT, TC_PROXYCLASSDESC, TC_REFERENCE, TC_RESET, TC_STRING`

Constructor Summary
`XMLObjectInputStream(java.io.InputStream in)` Constructor which reads data from the given input stream in order deserialize objects.

Method Summary
`void` | `close()` Method which closes the underlying input stream for reading.
`void` | `defaultReadObject()` Method which can be called by objects if they have a readObject() method.
`protected java.lang.Class` | `getClass(java.lang.String name)` Method which returns the class object for class names written to the stream.
`protected java.lang.Object` | `getReference(java.lang.String reference)` Method which returns a previously stored reference.
`protected java.lang.reflect.Constructor` | `getSerializableConstructor(java.lang.Class c)` Method which returns the Serializable constructor for the provided class.
`protected java.lang.Object` | `newInstance(java.lang.Class c)` Method which returns a new instance of the provided class.
`protected void` | `putReference(java.lang.String reference, java.lang.Object o)` Method which adds a reference in the hashtable of references.
`int` | `read()` Method which reads a byte from the underlying output stream.
`int` | `read(byte[] b, int offset, int length)` Method which reads a array of bytes from the underlying output stream.
`protected java.lang.Object` | `readArray(boolean shared)` Method which reads an array off of the stream.
`boolean` | `readBoolean()` Method which reads a boolean from the stream and returns the result.
`protected boolean` | `readBooleanHelper()` Method which reads an boolean from the stream.
`byte` | `readByte()` Method which reads a byte from the stream and returns the result.
`protected byte` | `readByteHelper()` Method which reads an byte from the stream.
`char` | `readChar()` Method which reads a char from the stream and returns the result.
`protected char` | `readCharHelper()` Method which reads an char from the stream.
`protected java.lang.Object` | `readClass(java.lang.Object o)` Method which reads the information for one class for a given object from the stream.
`double` | `readDouble()` Method which reads a double from the stream and returns the result.
`protected double` | `readDoubleHelper()` Method which reads an double from the stream.
`protected void` | `readField(java.lang.Object o, java.lang.Class c)` Method which reads a single field from the stream, and assignes it to the provided object.
`java.io.ObjectInputStream.GetField` | `readFields()` Method which can be called by objects if they have a readObject() method.
`protected void` | `readFields(java.lang.Object o, java.lang.Class c)` Method which initiates the default field reading mechanism for the given object's class.
`float` | `readFloat()` Method which reads a float from the stream and returns the result.
`protected float` | `readFloatHelper()` Method which reads an float from the stream.
`void` | `readFully(byte[] b)` Method which reads a byte from the underlying output stream.
`void` | `readFully(byte[] b, int offset, int length)` Method which reads a byte from the underlying output stream.
`protected void` | `readGetField(XMLObjectInputStream.GetField g)` Method which read a single field from the stream and places it in the provided GetField object.
`protected XMLObjectInputStream.GetField` | `readGetFields()` Method which reads all of the field data from the stream, as readFields() does, but instead of assigning the fields to the object, it returns them as a GetField object.
`int` | `readInt()` Method which reads an int from the stream and returns the result.
`protected int` | `readIntHelper()` Method which reads an int from the stream.
`long` | `readLong()` Method which reads a long from the stream and returns the result.
`protected long` | `readLongHelper()` Method which reads an long from the stream.
`protected java.lang.Object` | `readNull()` Method which reads a null item off of the stream.
`protected java.lang.Object` | `readObjectHelper()` Method which reads an object from the stream.
`protected java.lang.Object` | `readObjectOverride()` Method which is called by ObjectInputStreamm.readObject(), and reads the next object from the stream, and returns the result.
`protected java.lang.Object` | `readOrdinaryObject(boolean shared)` Method which reads an ordinary object from the stream (not a String or Array).
`protected java.lang.String` | `readPrimitive(java.lang.String type)` Method which reads a primitive value from the stream and returns the String representation to the callee for processing.
`protected void` | `readPrimitiveField(java.lang.Object o, java.lang.reflect.Field f)` Method which reads a primitive field from the stream, and places it in the given object.
`protected void` | `readPrimitiveGetField(XMLObjectInputStream.GetField g)` Method which reads a primitive field from the stream, and places it in the provided GetField object.
`protected java.lang.Object` | `readReference()` Method which reads a reference off of the stream, and looks the reference up in the references table.
`short` | `readShort()` Method which reads a short from the stream and returns the result.
`protected short` | `readShortHelper()` Method which reads an short from the stream.
`protected void` | `readStreamHeader()` Method which reads the XML header off of the stream.
`protected java.lang.Object` | `readString(boolean shared)` Method which reads a string item off of the stream.
`protected void` | `readUnreadOptionalData()` Method which reads any extra data from the stream which was not read by the object.
`java.lang.Object` | `readUnshared()` Method which reads the next object from the stream and does not record a reference to the object.
`protected java.lang.Object` | `readUnsharedHelper(boolean shared)` Method which reads an object from the stream.
`int` | `readUnsignedByte()` Method which reads an unsigned byte from the underlying output stream.
`int` | `readUnsignedShort()` Method which reads an unsigned short from the underlying output stream.
`java.lang.String` | `readUTF()` Method which reads a UTF-encoded String from the stream and returns the result.
`void` | `registerValidation(java.io.ObjectInputValidation obj, int prio)` Register an object to be validated before the graph is returned.
`void` | `reset()` Method which resets the input stream, which removes the binding of all previously stored references.

Methods inherited from class java.io.ObjectInputStream
`available, enableResolveObject, readClassDescriptor, readLine, readObject, resolveClass, resolveObject, resolveProxyClass, skipBytes`

Methods inherited from class java.io.InputStream
`mark, markSupported, read, skip`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Methods inherited from interface java.io.ObjectInput
`read, skip`

Field Detail

### reader

    protected XMLReader reader

  The underlying reader, which parses the XML

### references

    protected java.util.Hashtable references

  The hashtable of references, which is updated each time a new object is read off of the stream.

### currentObjects

    protected java.util.Stack currentObjects

  The stack of objects which are currently being read off of the stream

### currentClasses

    protected java.util.Stack currentClasses

  The stack of class types which are being read off of the stream

### reflFactory

    protected sun.reflect.ReflectionFactory reflFactory

  The ReflectionFactory, which allows for prividged construction of objects

### vlist

    protected rice.p2p.util.XMLObjectInputStream.ValidationList vlist

  The list of validation objects waiting for the entire object graph to be read in

### depth

    protected int depth

  The depth at which we are currently at in the object tree

### READ_RESOLVES

    protected static SoftHashMap READ_RESOLVES

  The hashmap of readResolve methods, mapping Class->Method

### READ_OBJECTS

    protected static SoftHashMap READ_OBJECTS

  The hashmap of readObject methods, mapping Class->Method

### CONSTRUCTORS

    protected static SoftHashMap CONSTRUCTORS

  A cache of constructors, mapping classes to serialization constructors

Constructor Detail

### XMLObjectInputStream

    public XMLObjectInputStream(java.io.InputStream in)
                         throws java.io.IOException

  Constructor which reads data from the given input stream in order deserialize objects. This constructor also reads the header from the stream, and throws an IOException if the correct header is not seen.

Parameters:
  `in` - The input stream to read data from
Throws:
  `java.io.IOException` - DESCRIBE THE EXCEPTION
  `java.io.IOException` - If the stream header is corrupt

Method Detail

### getSerializableConstructor

    protected java.lang.reflect.Constructor getSerializableConstructor(java.lang.Class c)
                                                                throws java.io.IOException,
                                                                       java.lang.NoSuchMethodException

  Method which returns the Serializable constructor for the provided class. This Constructor is the no-arg Constructor for the first non-Serializable class in the class's superclass heirarchy. This method does not cache the result, but does set the constructor to be accessible, regardless of the Java security protection.

  Parameters:
    `c` - The class to fetch the constructor for
  Returns:
    The SerializableConstructor value
  Throws:
    `java.io.IOException` - If an error occurs
    `java.lang.NoSuchMethodException` - If the first non-Serializable class does not have a no-arg Constructor

### getClass

    protected java.lang.Class getClass(java.lang.String name)
                                throws java.lang.ClassNotFoundException

  Method which returns the class object for class names written to the stream. If the name represents a primitive, the the X.TYPE class is returned, otherwise, Class.forName() is used.

  Parameters:
    `name` - The name of the class to return
  Returns:
    The Class value
  Throws:
    `java.lang.ClassNotFoundException` - If the class cannot be found

### getReference

    protected java.lang.Object getReference(java.lang.String reference)

  Method which returns a previously stored reference. If the reference cannot be found, null is returned.

  Parameters:
    `reference` - The reference to use
  Returns:
    The referenced object, or null if none can be found

### readStreamHeader

    protected void readStreamHeader()
                             throws java.io.IOException

  Method which reads the XML header off of the stream. Usually, this is the tag, but it may include processing instructions.

  Throws:
    `java.io.IOException` - If the stream header is corrupt

### close

    public void close()
               throws java.io.IOException

  Method which closes the underlying input stream for reading. Any subsequent reads will throw an IOException.

  Throws:
    `java.io.IOException` - If an error occurs

### reset

    public void reset()
               throws java.io.IOException

  Method which resets the input stream, which removes the binding of all previously stored references.

  Throws:
    `java.io.IOException` - If an error occurs

### read

    public int read()
             throws java.io.IOException

  Method which reads a byte from the underlying output stream. Simply calls readByte()

  Returns:
    DESCRIBE THE RETURN VALUE
  Throws:
    `java.io.IOException` - If an error occurs

### read

    public int read(byte[] b,
                    int offset,
                    int length)
             throws java.io.IOException

  Method which reads a array of bytes from the underlying output stream. Simply calls b[x] = readByte() on each of the array elements.

  Parameters:
    `b` - DESCRIBE THE PARAMETER
    `offset` - DESCRIBE THE PARAMETER
    `length` - DESCRIBE THE PARAMETER
  Returns:
    DESCRIBE THE RETURN VALUE
  Throws:
    `java.io.IOException` - If an error occurs

### readFully

    public void readFully(byte[] b)
                   throws java.io.IOException

  Method which reads a byte from the underlying output stream. Simply calls read()

  Parameters:
    `b` - DESCRIBE THE PARAMETER
  Throws:
    `java.io.IOException` - If an error occurs

### readFully

    public void readFully(byte[] b,
                          int offset,
                          int length)
                   throws java.io.IOException

  Method which reads a byte from the underlying output stream. Simply calls read()

  Parameters:
    `b` - DESCRIBE THE PARAMETER
    `offset` - DESCRIBE THE PARAMETER
    `length` - DESCRIBE THE PARAMETER
  Throws:
    `java.io.IOException` - If an error occurs

### readUnsignedByte

    public int readUnsignedByte()
                         throws java.io.IOException

  Method which reads an unsigned byte from the underlying output stream. Simply calls readByte()

  Returns:
    DESCRIBE THE RETURN VALUE
  Throws:
    `java.io.IOException` - If an error occurs

### readUnsignedShort

    public int readUnsignedShort()
                          throws java.io.IOException

  Method which reads an unsigned short from the underlying output stream. Simply calls readShort()

  Returns:
    DESCRIBE THE RETURN VALUE
  Throws:
    `java.io.IOException` - If an error occurs

### readInt

    public int readInt()
                throws java.io.IOException

  Method which reads an int from the stream and returns the result.

  Returns:
    The value from the stream
  Throws:
    `java.io.IOException` - If an error occurs

### readBoolean

    public boolean readBoolean()
                        throws java.io.IOException

  Method which reads a boolean from the stream and returns the result.

  Returns:
    The value from the stream
  Throws:
    `java.io.IOException` - If an error occurs

### readByte

    public byte readByte()
                  throws java.io.IOException

  Method which reads a byte from the stream and returns the result.

  Returns:
    The value from the stream
  Throws:
    `java.io.IOException` - If an error occurs

### readChar

    public char readChar()
                  throws java.io.IOException

  Method which reads a char from the stream and returns the result.

  Returns:
    The value from the stream
  Throws:
    `java.io.IOException` - If an error occurs

### readDouble

    public double readDouble()
                      throws java.io.IOException

  Method which reads a double from the stream and returns the result.

  Returns:
    The value from the stream
  Throws:
    `java.io.IOException` - If an error occurs

### readFloat

    public float readFloat()
                    throws java.io.IOException

  Method which reads a float from the stream and returns the result.

  Returns:
    The value from the stream
  Throws:
    `java.io.IOException` - If an error occurs

### readLong

    public long readLong()
                  throws java.io.IOException

  Method which reads a long from the stream and returns the result.

  Returns:
    The value from the stream
  Throws:
    `java.io.IOException` - If an error occurs

### readShort

    public short readShort()
                    throws java.io.IOException

  Method which reads a short from the stream and returns the result.

  Returns:
    The value from the stream
  Throws:
    `java.io.IOException` - If an error occurs

### readUTF

    public java.lang.String readUTF()
                             throws java.io.IOException

  Method which reads a UTF-encoded String from the stream and returns the result. This method simply calls readObject(), as all strings are UTF encoded in XML.

  Returns:
    The value from the stream
  Throws:
    `java.io.IOException` - If an error occurs

### readObjectOverride

    protected java.lang.Object readObjectOverride()
                                           throws java.io.IOException,
                                                  java.lang.ClassNotFoundException

  Method which is called by ObjectInputStreamm.readObject(), and reads the next object from the stream, and returns the result. If the object (or any of it's descendents) has a readResolve() method, that object is returned.

  Returns:
    The value from the stream
  Throws:
    `java.io.IOException` - If an error occurs
    `java.lang.ClassNotFoundException` - If a class in the stream cannot be found

### readUnshared

    public java.lang.Object readUnshared()
                                  throws java.io.IOException,
                                         java.lang.ClassNotFoundException

  Method which reads the next object from the stream and does not record a reference to the object. This guarantees that in future references to this object in the stream will throw an IOException.

  Returns:
    The next object from the stream, without recording a reference
  Throws:
    `java.io.IOException` - If an error occurs
    `java.lang.ClassNotFoundException` - If a class in the stream cannot be found

### defaultReadObject

    public void defaultReadObject()
                           throws java.io.IOException,
                                  java.lang.ClassNotFoundException

  Method which can be called by objects if they have a readObject() method. This method initiates the default field deserialization mechanism, and sets all of the object's fields from the stream. If this method is called, the readFields() method CANNOT be called by the same object. However, one of these two methods MUST be called in the context of a readObject().

  Throws:
    `java.io.IOException` - If an error occurs
    `java.lang.ClassNotFoundException` - If a class in the stream cannot be found
    `java.io.NotActiveException` - If a object is not currently being read

### readFields

    public java.io.ObjectInputStream.GetField readFields()
                                                  throws java.io.IOException,
                                                         java.lang.ClassNotFoundException

  Method which can be called by objects if they have a readObject() method. This method initiates the default field deserialization mechanism, and reads all of the default fields in the stream. It does NOT set the field values of the object, however, but instead returns the result to the Object as a GetField object. It is explicitly the responsibility of the object to set its fields appropriately. If this method is called, the defaultReadObject() method CANNOT be called by the same object. However, one of these two methods MUST be called in the context of a readObject().

  Returns:
    A GetField, representing all of this object's fields
  Throws:
    `java.io.IOException` - If an error occurs
    `java.lang.ClassNotFoundException` - If a class in the stream cannot be found
    `java.io.NotActiveException` - If a object is not currently being read

### registerValidation

    public void registerValidation(java.io.ObjectInputValidation obj,
                                   int prio)
                            throws java.io.NotActiveException,
                                   java.io.InvalidObjectException

  Register an object to be validated before the graph is returned. While similar to resolveObject these validations are called after the entire graph has been reconstituted. Typically, a readObject method will register the object with the stream so that when all of the objects are restored a final set of validations can be performed.

  Parameters:
    `obj` - the object to receive the validation callback.
    `prio` - controls the order of callbacks
  Throws:
    `java.io.NotActiveException` - The stream is not currently reading objects so it is invalid to register a callback.
    `java.io.InvalidObjectException` - The validation object is null.

### newInstance

    protected java.lang.Object newInstance(java.lang.Class c)
                                    throws java.io.IOException

  Method which returns a new instance of the provided class. It does this by getting the class's serializable constructor (described in getSerializableConstructor()) and using it to create a new object. Thus, all of the Serializable superclasses of the object must be initialized from the stream.

  Parameters:
    `c` - The class to create a new instance of
  Returns:
    DESCRIBE THE RETURN VALUE
  Throws:
    `java.io.IOException` - If an error occurs

### putReference

    protected void putReference(java.lang.String reference,
                                java.lang.Object o)

  Method which adds a reference in the hashtable of references. Multiple calls to this method will replace prior objects.

  Parameters:
    `reference` - The reference name to use
    `o` - The object to reference

### readPrimitive

    protected java.lang.String readPrimitive(java.lang.String type)
                                      throws java.io.IOException

  Method which reads a primitive value from the stream and returns the String representation to the callee for processing. This method assumes that the XML reader is currently on a primitive tag, and does consume the end primitive tag.

  Parameters:
    `type` - The type of primitive which should be next
  Returns:
    The String representation of the primitive
  Throws:
    `java.io.IOException` - If an error occurs

### readIntHelper

    protected int readIntHelper()
                         throws java.io.IOException

  Method which reads an int from the stream. This method assumes that the XML reader is currently on a primitive tag, and does consume the end primitive tag.

  Returns:
    The int read from the stream
  Throws:
    `java.io.IOException` - If an error occurs

### readBooleanHelper

    protected boolean readBooleanHelper()
                                 throws java.io.IOException

  Method which reads an boolean from the stream. This method assumes that the XML reader is currently on a primitive tag, and does consume the end primitive tag.

  Returns:
    The boolean read from the stream
  Throws:
    `java.io.IOException` - If an error occurs

### readByteHelper

    protected byte readByteHelper()
                           throws java.io.IOException

  Method which reads an byte from the stream. This method assumes that the XML reader is currently on a primitive tag, and does consume the end primitive tag.

  Returns:
    The byte read from the stream
  Throws:
    `java.io.IOException` - If an error occurs

### readCharHelper

    protected char readCharHelper()
                           throws java.io.IOException

  Method which reads an char from the stream. This method assumes that the XML reader is currently on a primitive tag, and does consume the end primitive tag.

  Returns:
    The char read from the stream
  Throws:
    `java.io.IOException` - If an error occurs

### readDoubleHelper

    protected double readDoubleHelper()
                               throws java.io.IOException

  Method which reads an double from the stream. This method assumes that the XML reader is currently on a primitive tag, and does consume the end primitive tag.

  Returns:
    The double read from the stream
  Throws:
    `java.io.IOException` - If an error occurs

### readFloatHelper

    protected float readFloatHelper()
                             throws java.io.IOException

  Method which reads an float from the stream. This method assumes that the XML reader is currently on a primitive tag, and does consume the end primitive tag.

  Returns:
    The float read from the stream
  Throws:
    `java.io.IOException` - If an error occurs

### readLongHelper

    protected long readLongHelper()
                           throws java.io.IOException

  Method which reads an long from the stream. This method assumes that the XML reader is currently on a primitive tag, and does consume the end primitive tag.

  Returns:
    The long read from the stream
  Throws:
    `java.io.IOException` - If an error occurs

### readShortHelper

    protected short readShortHelper()
                             throws java.io.IOException

  Method which reads an short from the stream. This method assumes that the XML reader is currently on a primitive tag, and does consume the end primitive tag.

  Returns:
    The short read from the stream
  Throws:
    `java.io.IOException` - If an error occurs

### readObjectHelper

    protected java.lang.Object readObjectHelper()
                                         throws java.io.IOException,
                                                java.lang.ClassNotFoundException

  Method which reads an object from the stream. This method assumes that the XML reader is currently on a start tag, and does consume the corresponding end tag. If the next object represents a reference or null, then the appropriate helper is called. Otherwise, readObjectUnshared() is called to process the object.

  Returns:
    The object read from the stream
  Throws:
    `java.io.IOException` - If an error occurs
    `java.lang.ClassNotFoundException` - If the class cannot be found

### readUnsharedHelper

    protected java.lang.Object readUnsharedHelper(boolean shared)
                                           throws java.io.IOException,
                                                  java.lang.ClassNotFoundException

  Method which reads an object from the stream. This method assumes that the XML reader is currently on a start tag, and does consume the corresponding end tag. This method also assumes that the type of object which is being read is *sharable*, even if it is not going to be shared. Thus, this method can read objects of type String, Array, or Serializable.

  Parameters:
    `shared` - Whether or not to record a reference to this object
  Returns:
    The object read from the stream
  Throws:
    `java.io.IOException` - If an error occurs
    `java.lang.ClassNotFoundException` - If the class cannot be found

### readReference

    protected java.lang.Object readReference()
                                      throws java.io.IOException,
                                             java.lang.ClassNotFoundException

  Method which reads a reference off of the stream, and looks the reference up in the references table. If not corresponding object is found, an IOException is thrown. This method expected that a reference tag has just been read, and it does consume the end reference tag.

  Returns:
    DESCRIBE THE RETURN VALUE
  Throws:
    `java.io.IOException` - If an error occurs or if a reference is not found
    `java.lang.ClassNotFoundException` - If the class cannot be found

### readNull

    protected java.lang.Object readNull()
                                 throws java.io.IOException,
                                        java.lang.ClassNotFoundException

  Method which reads a null item off of the stream. This method expected that a null tag has just been read, and it does consume the end null tag.

  Returns:
    DESCRIBE THE RETURN VALUE
  Throws:
    `java.io.IOException` - If an error occurs
    `java.lang.ClassNotFoundException` - If the class cannot be found

### readString

    protected java.lang.Object readString(boolean shared)
                                   throws java.io.IOException,
                                          java.lang.ClassNotFoundException

  Method which reads a string item off of the stream. This method expects that a start string tag has just been read, an it does consume the end start tag. If this string is to be shared, a reference is added to the references tag.

  Parameters:
    `shared` - Whether or not to add this string to the references table
  Returns:
    DESCRIBE THE RETURN VALUE
  Throws:
    `java.io.IOException` - If an error occurs
    `java.lang.ClassNotFoundException` - If the class cannot be found

### readOrdinaryObject

    protected java.lang.Object readOrdinaryObject(boolean shared)
                                           throws java.io.IOException,
                                                  java.lang.ClassNotFoundException

  Method which reads an ordinary object from the stream (not a String or Array). This method assumes that the XML reader is currently on a start tag, and does consume the corresponding end tag. This method first reads the class type, and if it is Serializable, it constructs a new instance. Then, if the object is shared and the id field is not null, it records a reference to the object. If the object is Externalizable, the readExternal() method is called and the object is returned. Otherwise, each of the superclasses are read, from highest to lowest, using the readClass() method. Lastly, if the object defines a readResolve() method, it is called and the result is recorded and returned.

  Parameters:
    `shared` - Whether or not to record a reference to this object
  Returns:
    The object read from the stream
  Throws:
    `java.io.IOException` - If an error occurs
    `java.lang.ClassNotFoundException` - If the class cannot be found
    `java.io.NotSerializableException` - If the class to be deserialized is not Serializable

### readClass

    protected java.lang.Object readClass(java.lang.Object o)
                                  throws java.io.IOException,
                                         java.lang.ClassNotFoundException

  Method which reads the information for one class for a given object from the stream. This method assumes that the XML reader is currently on a start declaredClass tag, and does consume the corresponding end declaredClass tag. This method first reads the class type, and if it defines a readObject() method, it is called. Otherwise, the fields are read in a default manner. Any extra data not read in the stream is read and ignored.

  Parameters:
    `o` - The object we are reading the the class for
  Returns:
    The object read from the stream
  Throws:
    `java.io.IOException` - If an error occurs
    `java.lang.ClassNotFoundException` - If the class cannot be found

### readUnreadOptionalData

    protected void readUnreadOptionalData()
                                   throws java.io.IOException,
                                          java.lang.ClassNotFoundException

  Method which reads any extra data from the stream which was not read by the object. This method simply loops until it hits the appropriate end declaredClass tag, and then returns. Thus, any data read by this method is ignored. However, the objects here are deserialized as the stream may reference them in the future.

  Throws:
    `java.io.IOException` - If an error occurs
    `java.lang.ClassNotFoundException` - If the class cannot be found

### readGetFields

    protected XMLObjectInputStream.GetField readGetFields()
                                                   throws java.io.IOException,
                                                          java.lang.ClassNotFoundException

  Method which reads all of the field data from the stream, as readFields() does, but instead of assigning the fields to the object, it returns them as a GetField object. In this manner, the object itself can perform field inititalization.

  Returns:
    The fields read from the stream
  Throws:
    `java.io.IOException` - If an error occurs
    `java.lang.ClassNotFoundException` - If the class cannot be found

### readGetField

    protected void readGetField(XMLObjectInputStream.GetField g)
                         throws java.io.IOException,
                                java.lang.ClassNotFoundException

  Method which read a single field from the stream and places it in the provided GetField object. This method assumes that the XML reader is on a start tag, and that the item read has a field attribute.

  Parameters:
    `g` - The GetField object into which the field should be put
  Throws:
    `java.io.IOException` - If an error occurs
    `java.lang.ClassNotFoundException` - If the class cannot be found

### readPrimitiveGetField

    protected void readPrimitiveGetField(XMLObjectInputStream.GetField g)
                                  throws java.io.IOException,
                                         java.lang.ClassNotFoundException

  Method which reads a primitive field from the stream, and places it in the provided GetField object. This method assumes that the XML parser has just read a primitive start tag, and that the tag has a field attribute. This method does consume that end primitive tag.

  Parameters:
    `g` - The GetField object to put the primitive in
  Throws:
    `java.lang.ClassNotFoundException` - DESCRIBE THE EXCEPTION
    `java.io.IOException` - If an error occurs

### readFields

    protected void readFields(java.lang.Object o,
                              java.lang.Class c)
                       throws java.io.IOException,
                              java.lang.ClassNotFoundException

  Method which initiates the default field reading mechanism for the given object's class. This method reads the start default tag, all of the fields, and then reads the end default tag. It reads all of the fields using the readField() method.

  Parameters:
    `o` - The object which is currently being read in
    `c` - The class to read the fields for
  Throws:
    `java.io.IOException` - If an error occurs
    `java.lang.ClassNotFoundException` - If the class cannot be found

### readField

    protected void readField(java.lang.Object o,
                             java.lang.Class c)
                      throws java.io.IOException,
                             java.lang.ClassNotFoundException

  Method which reads a single field from the stream, and assignes it to the provided object. If the field cannot be found in the given class, it is deserialized and then ignored, in case it is referenced later in the stream.

  Parameters:
    `o` - The object which is currently being read in
    `c` - The class to read the fields for
  Throws:
    `java.io.IOException` - If an error occurs
    `java.lang.ClassNotFoundException` - If the class cannot be found

### readPrimitiveField

    protected void readPrimitiveField(java.lang.Object o,
                                      java.lang.reflect.Field f)
                               throws java.io.IOException,
                                      java.lang.IllegalAccessException

  Method which reads a primitive field from the stream, and places it in the given object. This method assumes that the XML parser has just read a primitive start tag, and that the tag has a field attribute. This method does consume that end primitive tag.

  Parameters:
    `o` - The object to put the primitive in
    `f` - The field representing the primitive about to be read
  Throws:
    `java.lang.IllegalAccessException` - DESCRIBE THE EXCEPTION
    `java.io.IOException` - If an error occurs

### readArray

    protected java.lang.Object readArray(boolean shared)
                                  throws java.io.IOException,
                                         java.lang.ClassNotFoundException

  Method which reads an array off of the stream. This method expects that a start array tag has just been read, and does consume the end array tag. This method constructs an array of the provided base type, and then recursively reads in all of the objects for the array.

  Parameters:
    `shared` - Whether or not to add this array to the references table
  Returns:
    DESCRIBE THE RETURN VALUE
  Throws:
    `java.io.IOException` - If an error occurs
    `java.lang.ClassNotFoundException` - If the class cannot be found

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Rice Pastry API
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2001-2005 - Rice Pastry.