ObjectInput
public
interface
ObjectInput
implements
DataInput,
AutoCloseable
Known Indirect Subclasses
ObjectInputStream |
An ObjectInputStream deserializes primitive data and objects previously
written using an ObjectOutputStream.
|
|
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.
Summary
Public methods |
abstract
int
|
available()
Returns the number of bytes that can be read
without blocking.
|
abstract
void
|
close()
Closes the input stream.
|
abstract
int
|
read()
Reads a byte of data.
|
abstract
int
|
read(byte[] b, int off, int len)
Reads into an array of bytes.
|
abstract
int
|
read(byte[] b)
Reads into an array of bytes.
|
abstract
Object
|
readObject()
Read and return an object.
|
abstract
long
|
skip(long n)
Skips n bytes of input.
|
Public methods
available
int available ()
Returns the number of bytes that can be read
without blocking.
Returns |
int |
the number of available bytes. |
close
void close ()
Closes the input stream. Must be called
to release any resources associated with
the stream.
read
int read ()
Reads a byte of data. This method will block if no input is
available.
Returns |
int |
the byte read, or -1 if the end of the
stream is reached. |
read
int read (byte[] b,
int off,
int len)
Reads into an array of bytes. This method will
block until some input is available.
Parameters |
b |
byte :
the buffer into which the data is read |
off |
int :
the start offset of the data |
len |
int :
the maximum number of bytes read |
Returns |
int |
the actual number of bytes read, -1 is
returned when the end of the stream is reached. |
read
int read (byte[] b)
Reads into an array of bytes. This method will
block until some input is available.
Parameters |
b |
byte :
the buffer into which the data is read |
Returns |
int |
the actual number of bytes read, -1 is
returned when the end of the stream is reached. |
readObject
Object readObject ()
Read and return an object. The class that implements this interface
defines where the object is "read" from.
Returns |
Object |
the object read from the stream |
skip
long skip (long n)
Skips n bytes of input.
Parameters |
n |
long :
the number of bytes to be skipped |
Returns |
long |
the actual number of bytes skipped. |