Index (Frames) | Index (No Frames) | Package | Package Tree | Tree
java.io

Class ObjectInputStream

java.lang.Object
|
+--java.io.InputStream
   |
   +--java.io.ObjectInputStream

All Implemented Interfaces:

ObjectInput, ObjectStreamConstants


public class ObjectInputStream

extends InputStream

implements ObjectInput, ObjectStreamConstants

Constructor Summary

ObjectInputStream(java.io.InputStream in)

Creates a new ObjectInputStream that will do all of its reading from in.
ObjectInputStream()

Protected constructor that allows subclasses to override deserialization.

Method Summary

intavailable()

voidclose()

voiddefaultReadObject()

Reads the current objects non-transient, non-static fields from the current class from the underlying output stream.
booleanenableResolveObject(boolean enable)

If enable is true and this object is trusted, then resolveObject (Object) will be called in subsequent calls to readObject (Object).
intread()

intread(byte[] data, int offset, int length)

booleanreadBoolean()

bytereadByte()

charreadChar()

doublereadDouble()

java.io.ObjectInputStream.GetFieldreadFields()

floatreadFloat()

voidreadFully(byte[] data)

voidreadFully(byte[] data, int offset, int size)

intreadInt()

java.lang.StringreadLine()

longreadLong()

java.lang.ObjectreadObject()

Returns the next deserialized object read from the underlying stream.
java.lang.ObjectreadObjectOverride()

This method allows subclasses to override the default de serialization mechanism provided by ObjectInputStream.
shortreadShort()

voidreadStreamHeader()

Reads stream magic and stream version information from the underlying stream.
java.lang.StringreadUTF()

intreadUnsignedByte()

intreadUnsignedShort()

voidregisterValidation(java.io.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 ().
java.lang.ClassresolveClass(java.io.ObjectStreamClass osc)

Called when a class is being deserialized.
java.lang.ObjectresolveObject(java.lang.Object obj)

Allows subclasses to resolve objects that are read from the stream with other objects to be returned in their place.
java.lang.ClassresolveProxyClass(java.lang.String[] intfs)

intskipBytes(int len)

Constructor Details

ObjectInputStream

protected ObjectInputStream()

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.

See Also:


ObjectInputStream

public ObjectInputStream(java.io.InputStream in)

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).

Parameters:

Throws:

See Also:


Method Details

available

public int available()


close

public void close()


defaultReadObject

public void defaultReadObject()

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:


enableResolveObject

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). Otherwise, resolveObject (Object) will not be called.

Parameters:

Throws:


read

public int read()


read

public int read(byte[] data, int offset, int length)

Parameters:


readBoolean

public boolean readBoolean()


readByte

public byte readByte()


readChar

public char readChar()


readDouble

public double readDouble()


readFields

public ObjectInputStream.GetField readFields()


readFloat

public float readFloat()


readFully

public void readFully(byte[] data)

Parameters:


readFully

public void readFully(byte[] data, int offset, int size)

Parameters:


readInt

public int readInt()


readLine

public String readLine()

See Also:


readLong

public long readLong()


readObject

public final Object readObject()

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.

Throws:


readObjectOverride

protected Object readObjectOverride()

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.

See Also:


readShort

public short readShort()


readStreamHeader

protected void readStreamHeader()

Reads stream magic and stream version information from the underlying stream.

Throws:


readUTF

public String readUTF()


readUnsignedByte

public int readUnsignedByte()


readUnsignedShort

public int readUnsignedShort()


registerValidation

public void registerValidation(java.io.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 (). The order of validation for multiple ObjectInputValidations can be controled using priority. Validators with higher priorities are called first.

Parameters:

Throws:

See Also:


resolveClass

protected Class resolveClass(java.io.ObjectStreamClass osc)

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.

Parameters:

Throws:

See Also:


resolveObject

protected Object resolveObject(java.lang.Object obj)

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.

Parameters:

Throws:

See Also:


resolveProxyClass

protected Class resolveProxyClass(java.lang.String[] intfs)

Parameters:


skipBytes

public int skipBytes(int len)

Parameters: