java.io
Interface ObjectInput

All Superinterfaces:
DataInput sample code for java.io.DataInput definition code for java.io.DataInput
All Known Implementing Classes:
ObjectInputStream sample code for java.io.ObjectInputStream definition code for java.io.ObjectInputStream

public interface ObjectInput
extends DataInput sample code for java.io.DataInput definition code for java.io.DataInput

ObjectInput extends the DataInput interface to include the reading of objects. DataInput includes methods for the input of primitive types, ObjectInput extends that interface to include objects, arrays, and Strings.

Since:
JDK1.1
See Also:
InputStream sample code for java.io.InputStream definition code for java.io.InputStream , ObjectOutputStream sample code for java.io.ObjectOutputStream definition code for java.io.ObjectOutputStream , ObjectInputStream sample code for java.io.ObjectInputStream definition code for java.io.ObjectInputStream

Method Summary
 int available sample code for java.io.ObjectInput.available() definition code for java.io.ObjectInput.available() ()
          Returns the number of bytes that can be read without blocking.
 void close sample code for java.io.ObjectInput.close() definition code for java.io.ObjectInput.close() ()
          Closes the input stream.
 int read sample code for java.io.ObjectInput.read() definition code for java.io.ObjectInput.read() ()
          Reads a byte of data.
 int read sample code for java.io.ObjectInput.read(byte[]) definition code for java.io.ObjectInput.read(byte[]) (byte[] b)
          Reads into an array of bytes.
 int read sample code for java.io.ObjectInput.read(byte[], int, int) definition code for java.io.ObjectInput.read(byte[], int, int) (byte[] b, int off, int len)
          Reads into an array of bytes.
 Object sample code for java.lang.Object definition code for java.lang.Object readObject sample code for java.io.ObjectInput.readObject() definition code for java.io.ObjectInput.readObject() ()
          Read and return an object.
 long skip sample code for java.io.ObjectInput.skip(long) definition code for java.io.ObjectInput.skip(long) (long n)
          Skips n bytes of input.
 
Methods inherited from interface java.io.DataInput sample code for java.io.DataInput definition code for java.io.DataInput
readBoolean sample code for java.io.DataInput.readBoolean() definition code for java.io.DataInput.readBoolean() , readByte sample code for java.io.DataInput.readByte() definition code for java.io.DataInput.readByte() , readChar sample code for java.io.DataInput.readChar() definition code for java.io.DataInput.readChar() , readDouble sample code for java.io.DataInput.readDouble() definition code for java.io.DataInput.readDouble() , readFloat sample code for java.io.DataInput.readFloat() definition code for java.io.DataInput.readFloat() , readFully sample code for java.io.DataInput.readFully(byte[]) definition code for java.io.DataInput.readFully(byte[]) , readFully sample code for java.io.DataInput.readFully(byte[], int, int) definition code for java.io.DataInput.readFully(byte[], int, int) , readInt sample code for java.io.DataInput.readInt() definition code for java.io.DataInput.readInt() , readLine sample code for java.io.DataInput.readLine() definition code for java.io.DataInput.readLine() , readLong sample code for java.io.DataInput.readLong() definition code for java.io.DataInput.readLong() , readShort sample code for java.io.DataInput.readShort() definition code for java.io.DataInput.readShort() , readUnsignedByte sample code for java.io.DataInput.readUnsignedByte() definition code for java.io.DataInput.readUnsignedByte() , readUnsignedShort sample code for java.io.DataInput.readUnsignedShort() definition code for java.io.DataInput.readUnsignedShort() , readUTF sample code for java.io.DataInput.readUTF() definition code for java.io.DataInput.readUTF() , skipBytes sample code for java.io.DataInput.skipBytes(int) definition code for java.io.DataInput.skipBytes(int)
 

Method Detail

readObject sample code for java.io.ObjectInput.readObject() definition code for java.io.ObjectInput.readObject()

Object sample code for java.lang.Object definition code for java.lang.Object  readObject()
                  throws ClassNotFoundException sample code for java.lang.ClassNotFoundException definition code for java.lang.ClassNotFoundException ,
                         IOException sample code for java.io.IOException definition code for java.io.IOException 
Read and return an object. The class that implements this interface defines where the object is "read" from.

Returns:
the object read from the stream
Throws:
ClassNotFoundException sample code for java.lang.ClassNotFoundException definition code for java.lang.ClassNotFoundException - If the class of a serialized object cannot be found.
IOException sample code for java.io.IOException definition code for java.io.IOException - If any of the usual Input/Output related exceptions occur.

read sample code for java.io.ObjectInput.read() definition code for java.io.ObjectInput.read()

int read()
         throws IOException sample code for java.io.IOException definition code for java.io.IOException 
Reads a byte of data. This method will block if no input is available.

Returns:
the byte read, or -1 if the end of the stream is reached.
Throws:
IOException sample code for java.io.IOException definition code for java.io.IOException - If an I/O error has occurred.

read sample code for java.io.ObjectInput.read(byte[]) definition code for java.io.ObjectInput.read(byte[])

int read(byte[] b)
         throws IOException sample code for java.io.IOException definition code for java.io.IOException 
Reads into an array of bytes. This method will block until some input is available.

Parameters:
b - the buffer into which the data is read
Returns:
the actual number of bytes read, -1 is returned when the end of the stream is reached.
Throws:
IOException sample code for java.io.IOException definition code for java.io.IOException - If an I/O error has occurred.

read sample code for java.io.ObjectInput.read(byte[], int, int) definition code for java.io.ObjectInput.read(byte[], int, int)

int read(byte[] b,
         int off,
         int len)
         throws IOException sample code for java.io.IOException definition code for java.io.IOException 
Reads into an array of bytes. This method will block until some input is available.

Parameters:
b - the buffer into which the data is read
off - the start offset of the data
len - the maximum number of bytes read
Returns:
the actual number of bytes read, -1 is returned when the end of the stream is reached.
Throws:
IOException sample code for java.io.IOException definition code for java.io.IOException - If an I/O error has occurred.

skip sample code for java.io.ObjectInput.skip(long) definition code for java.io.ObjectInput.skip(long)

long skip(long n)
          throws IOException sample code for java.io.IOException definition code for java.io.IOException 
Skips n bytes of input.

Parameters:
n - the number of bytes to be skipped
Returns:
the actual number of bytes skipped.
Throws:
IOException sample code for java.io.IOException definition code for java.io.IOException - If an I/O error has occurred.

available sample code for java.io.ObjectInput.available() definition code for java.io.ObjectInput.available()

int available()
              throws IOException sample code for java.io.IOException definition code for java.io.IOException 
Returns the number of bytes that can be read without blocking.

Returns:
the number of available bytes.
Throws:
IOException sample code for java.io.IOException definition code for java.io.IOException - If an I/O error has occurred.

close sample code for java.io.ObjectInput.close() definition code for java.io.ObjectInput.close()

void close()
           throws IOException sample code for java.io.IOException definition code for java.io.IOException 
Closes the input stream. Must be called to release any resources associated with the stream.

Throws:
IOException sample code for java.io.IOException definition code for java.io.IOException - If an I/O error has occurred.