java.io
Class ObjectInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by java.io.ObjectInputStream
All Implemented Interfaces:
Closeable, DataInput, ObjectInput, ObjectStreamConstants

public class ObjectInputStream
extends InputStream
implements ObjectInput, ObjectStreamConstants


Nested Class Summary
static class ObjectInputStream.GetField
          This class allows a class to specify exactly which fields should be read, and what values should be read for these fields.
 
Field Summary
 
Fields inherited from interface java.io.ObjectStreamConstants
baseWireHandle, PROTOCOL_VERSION_1, PROTOCOL_VERSION_2, SC_BLOCK_DATA, SC_ENUM, 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_ENUM, TC_EXCEPTION, TC_LONGSTRING, TC_MAX, TC_NULL, TC_OBJECT, TC_PROXYCLASSDESC, TC_REFERENCE, TC_RESET, TC_STRING
 
Constructor Summary
protected ObjectInputStream()
          Protected constructor that allows subclasses to override deserialization.
  ObjectInputStream(InputStream in)
          Creates a new ObjectInputStream that will do all of its reading from in.
 
Method Summary
 int available()
          This method returns the number of bytes that can be read from this stream before a read can block.
 void close()
          This method closes the stream.
 void defaultReadObject()
          Reads the current objects non-transient, non-static fields from the current class from the underlying output stream.
protected  boolean enableResolveObject(boolean enable)
          If enable is true and this object is trusted, then resolveObject (Object) will be called in subsequent calls to readObject (Object).
 int read()
          This method reads an unsigned byte from the input stream and returns it as an int in the range of 0-255.
 int read(byte[] data, int offset, int length)
          This method read bytes from a stream and stores them into a caller supplied buffer.
 boolean readBoolean()
          This method reads a Java boolean value from an input stream.
 byte readByte()
          This method reads a Java byte value from an input stream.
 char readChar()
          This method reads a Java char value from an input stream.
protected  ObjectStreamClass readClassDescriptor()
          This method reads a class descriptor from the real input stream and use these data to create a new instance of ObjectStreamClass.
 double readDouble()
          This method reads a Java double value from an input stream.
 ObjectInputStream.GetField readFields()
          This method should be called by a method called 'readObject' in the deserializing class (if present).
 float readFloat()
          This method reads a Java float value from an input stream.
 void readFully(byte[] data)
          This method reads raw bytes into the passed array until the array is full.
 void readFully(byte[] data, int offset, int size)
          This method reads raw bytes into the passed array buf starting offset bytes into the buffer.
 int readInt()
          This method reads a Java int value from an input stream It operates by reading four bytes from the stream and converting them to a single Java int.
 String readLine()
          Deprecated.  
 long readLong()
          This method reads a Java long value from an input stream It operates by reading eight bytes from the stream and converting them to a single Java long.
 Object readObject()
          Returns the next deserialized object read from the underlying stream.
protected  Object readObjectOverride()
          This method allows subclasses to override the default de serialization mechanism provided by ObjectInputStream.
 short readShort()
          This method reads a signed 16-bit value into a Java in from the stream.
protected  void readStreamHeader()
          Reads stream magic and stream version information from the underlying stream.
 Object readUnshared()
           Returns the next deserialized object read from the underlying stream in an unshared manner.
 int readUnsignedByte()
          This method reads 8 unsigned bits into a Java int value from the stream.
 int readUnsignedShort()
          This method reads 16 unsigned bits into a Java int value from the stream.
 String readUTF()
          This method reads a String from an input stream that is encoded in a modified UTF-8 format.
 void registerValidation(ObjectInputValidation validator, int priority)
          Registers a ObjectInputValidation to be carried out on the object graph currently being deserialized before it is returned to the original caller of readObject ().
protected  Class<?> resolveClass(ObjectStreamClass osc)
          Called when a class is being deserialized.
protected  Object resolveObject(Object obj)
          Allows subclasses to resolve objects that are read from the stream with other objects to be returned in their place.
protected  Class<?> resolveProxyClass(String[] intfs)
           
 int skipBytes(int len)
          This method skips and discards the specified number of bytes in an input stream.
 
Methods inherited from class java.io.InputStream
mark, markSupported, read, reset, 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
 

Constructor Detail

ObjectInputStream

public ObjectInputStream(InputStream in)
                  throws IOException,
                         StreamCorruptedException
Creates a new ObjectInputStream that will do all of its reading from in. This method also checks the stream by reading the header information (stream magic number and stream version).

Throws:
IOException - Reading stream header from underlying stream cannot be completed.
StreamCorruptedException - An invalid stream magic number or stream version was read from the stream.
See Also:
readStreamHeader()

ObjectInputStream

protected ObjectInputStream()
                     throws IOException,
                            SecurityException
Protected constructor that allows subclasses to override deserialization. This constructor should be called by subclasses that wish to override readObject (Object). This method does a security check NOTE: currently not implemented, then sets a flag that informs readObject (Object) to call the subclasses readObjectOverride (Object) method.

Throws:
IOException
SecurityException
See Also:
readObjectOverride()
Method Detail

readObject

public final Object readObject()
                        throws ClassNotFoundException,
                               IOException
Returns the next deserialized object read from the underlying stream. This method can be overriden by a class by implementing private void readObject (ObjectInputStream). If an exception is thrown from this method, the stream is left in an undefined state. This method can also throw Errors and RuntimeExceptions if caused by existing readResolve() user code.

Specified by:
readObject in interface ObjectInput
Returns:
The object read from the underlying stream.
Throws:
ClassNotFoundException - The class that an object being read in belongs to cannot be found.
IOException - Exception from underlying InputStream.

readUnshared

public Object readUnshared()
                    throws IOException,
                           ClassNotFoundException

Returns the next deserialized object read from the underlying stream in an unshared manner. Any object returned by this method will not be returned by subsequent calls to either this method or readObject().

This behaviour is achieved by:

Returns:
a reference to the deserialized object.
Throws:
ClassNotFoundException - if the class of the object being deserialized can not be found.
StreamCorruptedException - if information in the stream is inconsistent.
ObjectStreamException - if the next object has already been returned by an earlier call to this method or readObject().
OptionalDataException - if primitive data occurs next in the stream.
IOException - if an I/O error occurs from the stream.
Since:
1.4
See Also:
readObject()

readClassDescriptor

protected ObjectStreamClass readClassDescriptor()
                                         throws ClassNotFoundException,
                                                IOException
This method reads a class descriptor from the real input stream and use these data to create a new instance of ObjectStreamClass. Fields are sorted and ordered for the real read which occurs for each instance of the described class. Be aware that if you call that method you must ensure that the stream is synchronized, in the other case it may be completely desynchronized.

Returns:
A new instance of ObjectStreamClass containing the freshly created descriptor.
Throws:
ClassNotFoundException - if the required class to build the descriptor has not been found in the system.
IOException - An input/output error occured.
InvalidClassException - If there was a compatibility problem between the class present in the system and the serialized class.

defaultReadObject

public void defaultReadObject()
                       throws ClassNotFoundException,
                              IOException,
                              NotActiveException
Reads the current objects non-transient, non-static fields from the current class from the underlying output stream. This method is intended to be called from within a object's private void readObject (ObjectInputStream) method.

Throws:
ClassNotFoundException - The class that an object being read in belongs to cannot be found.
NotActiveException - This method was called from a context other than from the current object's and current class's private void readObject (ObjectInputStream) method.
IOException - Exception from underlying OutputStream.

registerValidation

public void registerValidation(ObjectInputValidation validator,
                               int priority)
                        throws InvalidObjectException,
                               NotActiveException
Registers a ObjectInputValidation to be carried out on the object graph currently being deserialized before it is returned to the original caller of readObject (). The order of validation for multiple ObjectInputValidations can be controled using priority. Validators with higher priorities are called first.

Throws:
InvalidObjectException - validator is null
NotActiveException - an attempt was made to add a validator outside of the readObject method of the object currently being deserialized
See Also:
ObjectInputValidation

resolveClass

protected Class<?> resolveClass(ObjectStreamClass osc)
                         throws ClassNotFoundException,
                                IOException
Called when a class is being deserialized. This is a hook to allow subclasses to read in information written by the annotateClass (Class) method of an ObjectOutputStream. This implementation looks up the active call stack for a ClassLoader; if a ClassLoader is found, it is used to load the class associated with osc, otherwise, the default system ClassLoader is used.

Throws:
IOException - Exception from underlying OutputStream.
ClassNotFoundException
See Also:
(java.lang.Class)

resolveObject

protected Object resolveObject(Object obj)
                        throws IOException
Allows subclasses to resolve objects that are read from the stream with other objects to be returned in their place. This method is called the first time each object is encountered. This method must be enabled before it will be called in the serialization process.

Throws:
IOException - Exception from underlying OutputStream.
See Also:
enableResolveObject(boolean)

resolveProxyClass

protected Class<?> resolveProxyClass(String[] intfs)
                              throws IOException,
                                     ClassNotFoundException
Throws:
IOException
ClassNotFoundException

enableResolveObject

protected boolean enableResolveObject(boolean enable)
                               throws SecurityException
If enable is true and this object is trusted, then resolveObject (Object) will be called in subsequent calls to readObject (Object). Otherwise, resolveObject (Object) will not be called.

Throws:
SecurityException - This class is not trusted.

readStreamHeader

protected void readStreamHeader()
                         throws IOException,
                                StreamCorruptedException
Reads stream magic and stream version information from the underlying stream.

Throws:
IOException - Exception from underlying stream.
StreamCorruptedException - An invalid stream magic number or stream version was read from the stream.

read

public int read()
         throws IOException
Description copied from class: InputStream
This method reads an unsigned byte from the input stream and returns it as an int in the range of 0-255. This method also will return -1 if the end of the stream has been reached.

This method will block until the byte can be read.

Specified by:
read in interface ObjectInput
Specified by:
read in class InputStream
Returns:
The byte read or -1 if end of stream
Throws:
IOException - If an error occurs

read

public int read(byte[] data,
                int offset,
                int length)
         throws IOException
Description copied from class: InputStream
This method read bytes from a stream and stores them into a caller supplied buffer. It starts storing the data at index off into the buffer and attempts to read len bytes. This method can return before reading the number of bytes requested. The actual number of bytes read is returned as an int. A -1 is returned to indicate the end of the stream.

This method will block until some data can be read.

This method operates by calling the single byte read() method in a loop until the desired number of bytes are read. The read loop stops short if the end of the stream is encountered or if an IOException is encountered on any read operation except the first. If the first attempt to read a bytes fails, the IOException is allowed to propagate upward. And subsequent IOException is caught and treated identically to an end of stream condition. Subclasses can (and should if possible) override this method to provide a more efficient implementation.

Specified by:
read in interface ObjectInput
Overrides:
read in class InputStream
Parameters:
data - The array into which the bytes read should be stored
offset - The offset into the array to start storing bytes
length - The requested number of bytes to read
Returns:
The actual number of bytes read, or -1 if end of stream.
Throws:
IOException - If an error occurs.

available

public int available()
              throws IOException
Description copied from class: InputStream
This method returns the number of bytes that can be read from this stream before a read can block. A return of 0 indicates that blocking might (or might not) occur on the very next read attempt.

This method always returns 0 in this class

Specified by:
available in interface ObjectInput
Overrides:
available in class InputStream
Returns:
The number of bytes that can be read before blocking could occur
Throws:
IOException - If an error occurs

close

public void close()
           throws IOException
Description copied from class: InputStream
This method closes the stream. Any futher attempts to read from the stream may generate an IOException

This method does nothing in this class, but subclasses may override this method in order to provide additional functionality.

Specified by:
close in interface Closeable
Specified by:
close in interface ObjectInput
Overrides:
close in class InputStream
Throws:
IOException - If an error occurs, which can only happen in a subclass

readBoolean

public boolean readBoolean()
                    throws IOException
Description copied from interface: DataInput
This method reads a Java boolean value from an input stream. It does so by reading a single byte of data. If that byte is zero, then the value returned is false. If the byte is non-zero, then the value returned is true.

This method can read a boolean written by an object implementing the writeBoolean() method in the DataOutput interface.

Specified by:
readBoolean in interface DataInput
Returns:
The boolean value read
Throws:
EOFException - If end of file is reached before reading the boolean
IOException - If any other error occurs
See Also:
DataOutput.writeBoolean(boolean)

readByte

public byte readByte()
              throws IOException
Description copied from interface: DataInput
This method reads a Java byte value from an input stream. The value is in the range of -128 to 127.

This method can read a byte written by an object implementing the writeByte() method in the DataOutput interface.

Specified by:
readByte in interface DataInput
Returns:
The byte value read
Throws:
EOFException - If end of file is reached before reading the byte
IOException - If any other error occurs
See Also:
DataOutput.writeByte(int)

readUnsignedByte

public int readUnsignedByte()
                     throws IOException
Description copied from interface: DataInput
This method reads 8 unsigned bits into a Java int value from the stream. The value returned is in the range of 0 to 255.

This method can read an unsigned byte written by an object implementing the writeByte() method in the DataOutput interface.

Specified by:
readUnsignedByte in interface DataInput
Returns:
The unsigned bytes value read as a Java int.
Throws:
EOFException - If end of file is reached before reading the value
IOException - If any other error occurs
See Also:
DataOutput.writeByte(int)

readShort

public short readShort()
                throws IOException
Description copied from interface: DataInput
This method reads a signed 16-bit value into a Java in from the stream. It operates by reading two bytes from the stream and converting them to a single 16-bit Java short. The two bytes are stored most significant byte first (i.e., "big endian") regardless of the native host byte ordering.

As an example, if byte1 and byte2 represent the first and second byte read from the stream respectively, they will be transformed to a short in the following manner:

(short)(((byte1 & 0xFF) << 8) + (byte2 & 0xFF))

The value returned is in the range of -32768 to 32767.

This method can read a short written by an object implementing the writeShort() method in the DataOutput interface.

Specified by:
readShort in interface DataInput
Returns:
The short value read
Throws:
EOFException - If end of file is reached before reading the value
IOException - If any other error occurs
See Also:
DataOutput.writeShort(int)

readUnsignedShort

public int readUnsignedShort()
                      throws IOException
Description copied from interface: DataInput
This method reads 16 unsigned bits into a Java int value from the stream. It operates by reading two bytes from the stream and converting them to a single Java int. The two bytes are stored most significant byte first (i.e., "big endian") regardless of the native host byte ordering.

As an example, if byte1 and byte2 represent the first and second byte read from the stream respectively, they will be transformed to an int in the following manner:

(int)(((byte1 0xFF) << 8) + (byte2 & 0xFF))

The value returned is in the range of 0 to 65535.

This method can read an unsigned short written by an object implementing the writeShort() method in the DataOutput interface.

Specified by:
readUnsignedShort in interface DataInput
Returns:
The unsigned short value read as a Java int.
Throws:
EOFException - If end of file is reached before reading the value
IOException - If any other error occurs
See Also:
DataOutput.writeShort(int)

readChar

public char readChar()
              throws IOException
Description copied from interface: DataInput
This method reads a Java char value from an input stream. It operates by reading two bytes from the stream and converting them to a single 16-bit Java char. The two bytes are stored most significant byte first (i.e., "big endian") regardless of the native host byte ordering.

As an example, if byte1 and byte2 represent the first and second byte read from the stream respectively, they will be transformed to a char in the following manner:

(char)((byte1 << 8) + byte2)

This method can read a char written by an object implementing the writeChar() method in the DataOutput interface.

Specified by:
readChar in interface DataInput
Returns:
The char value read
Throws:
EOFException - If end of file is reached before reading the char
IOException - If any other error occurs
See Also:
DataOutput.writeChar(int)

readInt

public int readInt()
            throws IOException
Description copied from interface: DataInput
This method reads a Java int value from an input stream It operates by reading four bytes from the stream and converting them to a single Java int. The bytes are stored most significant byte first (i.e., "big endian") regardless of the native host byte ordering.

As an example, if byte1 through byte4 represent the first four bytes read from the stream, they will be transformed to an int in the following manner:

(int)(((byte1 & 0xFF) << 24) + ((byte2 & 0xFF) << 16) + ((byte3 & 0xFF)<< 8) + (byte4 & 0xFF)))

The value returned is in the range of -2147483648 to 2147483647.

This method can read an int written by an object implementing the writeInt() method in the DataOutput interface.

Specified by:
readInt in interface DataInput
Returns:
The int value read
Throws:
EOFException - If end of file is reached before reading the int
IOException - If any other error occurs
See Also:
DataOutput.writeInt(int)

readLong

public long readLong()
              throws IOException
Description copied from interface: DataInput
This method reads a Java long value from an input stream It operates by reading eight bytes from the stream and converting them to a single Java long. The bytes are stored most significant byte first (i.e., "big endian") regardless of the native host byte ordering.

As an example, if byte1 through byte8 represent the first eight bytes read from the stream, they will be transformed to an long in the following manner:

(long)(((byte1 & 0xFF) << 56) + ((byte2 & 0xFF) << 48) + ((byte3 & 0xFF) << 40) + ((byte4 & 0xFF) << 32) + ((byte5 & 0xFF) << 24) + ((byte6 & 0xFF) << 16) + ((byte7 & 0xFF) << 8) + (byte8 & 0xFF)))

The value returned is in the range of -9223372036854775808 to 9223372036854775807.

This method can read an long written by an object implementing the writeLong() method in the DataOutput interface.

Specified by:
readLong in interface DataInput
Returns:
The long value read
Throws:
EOFException - If end of file is reached before reading the long
IOException - If any other error occurs
See Also:
DataOutput.writeLong(long)

readFloat

public float readFloat()
                throws IOException
Description copied from interface: DataInput
This method reads a Java float value from an input stream. It operates by first reading an int value from the stream by calling the readInt() method in this interface, then converts that int to a float using the intBitsToFloat method in the class java.lang.Float.

This method can read a float written by an object implementing the writeFloat() method in the DataOutput interface.

Specified by:
readFloat in interface DataInput
Returns:
The float value read
Throws:
EOFException - If end of file is reached before reading the float
IOException - If any other error occurs
See Also:
DataOutput.writeFloat(float), Float.intBitsToFloat(int)

readDouble

public double readDouble()
                  throws IOException
Description copied from interface: DataInput
This method reads a Java double value from an input stream. It operates by first reading a long value from the stream by calling the readLong() method in this interface, then converts that long to a double using the longBitsToDouble method in the class java.lang.Double.

This method can read a double written by an object implementing the writeDouble() method in the DataOutput interface.

Specified by:
readDouble in interface DataInput
Returns:
The double value read
Throws:
EOFException - If end of file is reached before reading the double
IOException - If any other error occurs
See Also:
DataOutput.writeDouble(double), Double.longBitsToDouble(long)

readFully

public void readFully(byte[] data)
               throws IOException
Description copied from interface: DataInput
This method reads raw bytes into the passed array until the array is full. Note that this method blocks until the data is available and throws an exception if there is not enough data left in the stream to fill the buffer. Note also that zero length buffers are permitted. In this case, the method will return immediately without reading any bytes from the stream.

Specified by:
readFully in interface DataInput
Parameters:
data - The buffer into which to read the data
Throws:
EOFException - If end of file is reached before filling the buffer
IOException - If any other error occurs

readFully

public void readFully(byte[] data,
                      int offset,
                      int size)
               throws IOException
Description copied from interface: DataInput
This method reads raw bytes into the passed array buf starting offset bytes into the buffer. The number of bytes read will be exactly len. Note that this method blocks until the data is available and throws an exception if there is not enough data left in the stream to read len bytes. Note also that zero length buffers are permitted. In this case, the method will return immediately without reading any bytes from the stream.

Specified by:
readFully in interface DataInput
Parameters:
data - The buffer into which to read the data
offset - The offset into the buffer to start storing data
size - The number of bytes to read into the buffer
Throws:
EOFException - If end of file is reached before filling the buffer
IOException - If any other error occurs

skipBytes

public int skipBytes(int len)
              throws IOException
Description copied from interface: DataInput
This method skips and discards the specified number of bytes in an input stream. Note that this method may skip less than the requested number of bytes. The actual number of bytes skipped is returned. No bytes are skipped if a negative number is passed to this method.

Specified by:
skipBytes in interface DataInput
Parameters:
len - The number of bytes to skip
Returns:
The number of bytes actually skipped, which will always be numBytes
Throws:
EOFException - If end of file is reached before all bytes can be skipped
IOException - If any other error occurs

readLine

public String readLine()
                throws IOException
Deprecated. 

Description copied from interface: DataInput
This method reads the next line of text data from an input stream. It operates by reading bytes and converting those bytes to char values by treating the byte read as the low eight bits of the char and using 0 as the high eight bits. Because of this, it does not support the full 16-bit Unicode character set.

The reading of bytes ends when either the end of file or a line terminator is encountered. The bytes read are then returned as a String. A line terminator is a byte sequence consisting of either \r, \n or \r\n. These termination charaters are discarded and are not returned as part of the string. A line is also terminated by an end of file condition.

Specified by:
readLine in interface DataInput
Returns:
The line read as a String
Throws:
IOException - If an error occurs
See Also:
()

readUTF

public String readUTF()
               throws IOException
Description copied from interface: DataInput
This method reads a String from an input stream that is encoded in a modified UTF-8 format. This format has a leading two byte sequence that contains the remaining number of bytes to read. This two byte sequence is read using the readUnsignedShort() method of this interface. After the number of remaining bytes have been determined, these bytes are read an transformed into char values. These char values are encoded in the stream using either a one, two, or three byte format. The particular format in use can be determined by examining the first byte read.

If the first byte has a high order bit of 0, then that character consists on only one byte. This character value consists of seven bits that are at positions 0 through 6 of the byte. As an example, if byte1 is the byte read from the stream, it would be converted to a char like so:

(char)byte1

If the first byte has 110 as its high order bits, then the character consists of two bytes. The bits that make up the character value are in positions 0 through 4 of the first byte and bit positions 0 through 5 of the second byte. (The second byte should have 10 as its high order bits). These values are in most significant byte first (i.e., "big endian") order.

As an example, if byte1 and byte2 are the first two bytes read respectively, and the high order bits of them match the patterns which indicate a two byte character encoding, then they would be converted to a Java char like so:

(char)(((byte1 & 0x1F) << 6) + (byte2 & 0x3F))

If the first byte has a 1110 as its high order bits, then the character consists of three bytes. The bits that make up the character value are in positions 0 through 3 of the first byte and bit positions 0 through 5 of the other two bytes. (The second and third bytes should have 10 as their high order bits). These values are in most significant byte first (i.e., "big endian") order.

As an example, if byte1, byte2, and byte3 are the three bytes read, and the high order bits of them match the patterns which indicate a three byte character encoding, then they would be converted to a Java char like so: (char)(((byte1 & 0x0F) << 12) + ((byte2 & 0x3F) + (byte3 & 0x3F)) Note that all characters are encoded in the method that requires the fewest number of bytes with the exception of the character with the value of \<llll>u0000 which is encoded as two bytes. This is a modification of the UTF standard used to prevent C language style NUL values from appearing in the byte stream.

This method can read data that was written by an object implementing the writeUTF() method in DataOutput.

Specified by:
readUTF in interface DataInput
Returns:
The String read
Throws:
EOFException - If end of file is reached before reading the String
UTFDataFormatException - If the data is not in UTF-8 format
IOException - If any other error occurs
See Also:
DataOutput.writeUTF(java.lang.String)

readFields

public ObjectInputStream.GetField readFields()
                                      throws IOException,
                                             ClassNotFoundException,
                                             NotActiveException
This method should be called by a method called 'readObject' in the deserializing class (if present). It cannot (and should not)be called outside of it. Its goal is to read all fields in the real input stream and keep them accessible through the ObjectInputStream.GetField class. Calling this method will not alter the deserializing object.

Returns:
A valid freshly created 'GetField' instance to get access to the deserialized stream.
Throws:
IOException - An input/output exception occured.
ClassNotFoundException
NotActiveException

readObjectOverride

protected Object readObjectOverride()
                             throws ClassNotFoundException,
                                    IOException,
                                    OptionalDataException
This method allows subclasses to override the default de serialization mechanism provided by ObjectInputStream. To make this method be used for writing objects, subclasses must invoke the 0-argument constructor on this class from their constructor.

Throws:
ClassNotFoundException
IOException
OptionalDataException
See Also:
ObjectInputStream()