| java.lang.Object | |||
| ↳ | java.io.InputStream | ||
| ↳ | java.io.FilterInputStream | ||
| ↳ | java.io.DataInputStream | ||
Wraps an existing InputStream and reads typed data from it. Typically, this stream has been written by a DataOutputStream. Types that can be read include byte, 16-bit short, 32-bit int, 32-bit float, 64-bit long, 64-bit double, byte strings, and strings encoded in modified UTF-8.
|
[Expand]
Inherited Fields | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.io.FilterInputStream
| |||||||||||
| Public Constructors | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
Constructs a new DataInputStream on the InputStream
in. | |||||||||||
| Public Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
Reads at most
length bytes from this stream and stores them in
the byte array buffer starting at offset. | |||||||||||
Reads bytes from this stream into the byte array
buffer. | |||||||||||
Reads a boolean from this stream.
| |||||||||||
Reads an 8-bit byte value from this stream.
| |||||||||||
Reads a 16-bit character value from this stream.
| |||||||||||
Reads a 64-bit double value from this stream.
| |||||||||||
Reads a 32-bit float value from this stream.
| |||||||||||
Reads bytes from this stream and stores them in the byte array
buffer starting at the position offset. | |||||||||||
Reads bytes from this stream into the byte array
buffer. | |||||||||||
Reads a 32-bit integer value from this stream.
| |||||||||||
This method is deprecated.
Use BufferedReader
| |||||||||||
Reads a 64-bit long value from this stream.
| |||||||||||
Reads a 16-bit short value from this stream.
| |||||||||||
Reads an string encoded in modified UTF-8 from this
stream.
| |||||||||||
Reads an unsigned 8-bit byte value from this stream and returns it as an
int.
| |||||||||||
Reads a 16-bit unsigned short value from this stream and returns it as an
int.
| |||||||||||
Skips
count number of bytes in this stream. | |||||||||||
|
[Expand]
Inherited Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
From class java.io.FilterInputStream
| |||||||||||
From class java.io.InputStream
| |||||||||||
From class java.lang.Object
| |||||||||||
From interface java.io.Closeable
| |||||||||||
From interface java.io.DataInput
| |||||||||||
Constructs a new DataInputStream on the InputStream in. All
reads are then filtered through this stream. Note that data read by this
stream is not in a human readable format and was most likely created by a
DataOutputStream.
| in | the source InputStream the filter reads from. |
|---|
Reads at most length bytes from this stream and stores them in
the byte array buffer starting at offset. Returns the
number of bytes that have been read or -1 if no bytes have been read and
the end of the stream has been reached.
| buffer | the byte array in which to store the bytes read. |
|---|---|
| offset | the initial position in buffer to store the bytes
read from this stream. |
| length | the maximum number of bytes to store in buffer. |
| IOException | if a problem occurs while reading from this stream. |
|---|
Reads bytes from this stream into the byte array buffer. Returns
the number of bytes that have been read.
| buffer | the buffer to read bytes into. |
|---|
| IOException | if a problem occurs while reading from this stream. |
|---|
Reads a boolean from this stream.
| EOFException | if the end of the filtered stream is reached before one byte has been read. |
|---|---|
| IOException | if a problem occurs while reading from this stream. |
Reads an 8-bit byte value from this stream.
| EOFException | if the end of the filtered stream is reached before one byte has been read. |
|---|---|
| IOException | if a problem occurs while reading from this stream. |
Reads a 16-bit character value from this stream.
| EOFException | if the end of the filtered stream is reached before two bytes have been read. |
|---|---|
| IOException | if a problem occurs while reading from this stream. |
Reads a 64-bit double value from this stream.
| EOFException | if the end of the filtered stream is reached before eight bytes have been read. |
|---|---|
| IOException | if a problem occurs while reading from this stream. |
Reads a 32-bit float value from this stream.
| EOFException | if the end of the filtered stream is reached before four bytes have been read. |
|---|---|
| IOException | if a problem occurs while reading from this stream. |
Reads bytes from this stream and stores them in the byte array buffer starting at the position offset. This method blocks until
length bytes have been read. If length is zero, then this
method returns without reading any bytes.
| buffer | the byte array into which the data is read. |
|---|---|
| offset | the offset in buffer from where to store the bytes
read. |
| length | the maximum number of bytes to read. |
| EOFException | if the end of the source stream is reached before enough bytes have been read. |
|---|---|
| IndexOutOfBoundsException | if offset < 0 or length < 0, or if offset + length is greater than the size of buffer. |
| IOException | if a problem occurs while reading from this stream. |
| NullPointerException | if buffer or the source stream are null. |
Reads bytes from this stream into the byte array buffer. This
method will block until buffer.length number of bytes have been
read.
| buffer | to read bytes into. |
|---|
| EOFException | if the end of the source stream is reached before enough bytes have been read. |
|---|---|
| IOException | if a problem occurs while reading from this stream. |
Reads a 32-bit integer value from this stream.
| EOFException | if the end of the filtered stream is reached before four bytes have been read. |
|---|---|
| IOException | if a problem occurs while reading from this stream. |
This method is deprecated.Use BufferedReader
Returns a string that contains the next line of text available from the
source stream. A line is represented by zero or more characters followed
by '\n', '\r', "\r\n" or the end of the stream.
The string does not include the newline sequence.
null if no characters were
read before the end of the source stream has been reached.| IOException | if a problem occurs while reading from this stream. |
|---|
Reads a 64-bit long value from this stream.
| EOFException | if the end of the filtered stream is reached before eight bytes have been read. |
|---|---|
| IOException | if a problem occurs while reading from this stream. |
Reads a 16-bit short value from this stream.
| EOFException | if the end of the filtered stream is reached before two bytes have been read. |
|---|---|
| IOException | if a problem occurs while reading from this stream. |
Reads an string encoded in modified UTF-8 from this stream.
| EOFException | if the end of the input is reached before the read request can be satisfied. |
|---|---|
| IOException | if a problem occurs while reading from this stream. |
Reads a string encoded in modified UTF-8 from the
DataInput stream in.
| in | the input stream to read from. |
|---|
| IOException | if a problem occurs while reading from this stream. |
|---|
Reads an unsigned 8-bit byte value from this stream and returns it as an int.
| EOFException | if the end of the filtered stream has been reached before one byte has been read. |
|---|---|
| IOException | if a problem occurs while reading from this stream. |
Reads a 16-bit unsigned short value from this stream and returns it as an int.
| EOFException | if the end of the filtered stream is reached before two bytes have been read. |
|---|---|
| IOException | if a problem occurs while reading from this stream. |
Skips count number of bytes in this stream. Subsequent read()s will not return these bytes unless reset() is used.
This method will not throw an EOFException if the end of the
input is reached before count bytes where skipped.
| count | the number of bytes to skip. |
|---|
| IOException | if a problem occurs during skipping. |
|---|