java.io.ObjectInput
java.io.DataInput
None
java.io.ObjectInputStream
New as of JDK 1.1
The ObjectInput interface extends the DataInput interface for object serialization. While DataInput defines methods for reading primitive types from a stream, ObjectInput defines methods for reading objects and arrays of bytes.
public abstract interface java.io.ObjectInput extends java.io.DataInput { // Methods public abstract int available(); public abstract void close(); public abstract int read(); public abstract int read(byte[] b); public abstract int read(byte[] b, int off, int len); public abstract Object readObject(); public abstract long skip(long n); }
The number of bytes that can be read without blocking.
If any kind of I/O error occurs.
This method returns the number of bytes that can be read from the stream without accessing a physical device, like a disk or a network.
If any kind of I/O error occurs.
This method closes the stream and releases any system resources associated with it.
The next byte of data or -1 if the end of the stream is encountered.
If any kind of I/O error occurs.
This method returns the next byte of data from the stream. The method blocks until the byte is read, the end of stream is detected, or an exception is thrown.
An array of bytes to be filled from the stream.
The actual number of bytes read or -1 if the end of the stream is encountered immediately.
If any kind of I/O error occurs.
This method reads bytes from the stream to fill the given array. The method blocks until some data is available.
public abstract int read(byte[] b, int off, int len) throws IOException
An array of bytes to be filled from the stream.
An offset into the array.
The number of bytes to read.
The actual number of bytes read or -1 if the end of the stream is encountered immediately.
If any kind of I/O error occurs.
This method reads up to len bytes of input into the given array starting at index off. The method blocks until some data is available.
public abstract Object readObject() throws ClassNotFoundException, IOException
An Object that has been deserialized from the stream.
If the class of the serialized object cannot be found in the run-time environment.
If any kind of I/O error occurs.
This method reads and returns an object instance from the stream; in other words, it deserializes an object from the stream. The class that implements this interface determines exactly how the object is to be read.
The number of bytes to skip.
The actual number of bytes skipped.
If any kind of I/O error occurs.
This method skips n bytes of input.
Method | Inherited From | Method | Inherited From |
---|---|---|---|
readBoolean() |
DataInput |
readByte() |
DataInput |
readChar() |
DataInput |
readDouble() |
DataInput |
readFloat(byte[]) |
DataInput |
readFully(byte[]) |
DataInput |
readFully(byte[], int, int) |
DataInput |
readInt() |
DataInput |
readLine() |
DataInput |
readLong() |
DataInput |
readShort() |
DataInput |
readUnsignedByte() |
DataInput |
readUnsignedChar() |
DataInput |
readUTF() |
DataInput |
skipBytes(int) |
DataInput |
DataInput, ObjectInputStream