DataInput for reading from in-memory byte arrays; its methods offer
identical functionality but do not throw IOException.Warning
The caller is responsible for not attempting to read past the end of the
array. If any method encounters the end of the array prematurely, it throws IllegalStateException to signify programmer error. This behavior is a technical violation
of the supertype's contract, which specifies a checked exception.
| Modifier and Type | Method and Description |
|---|---|
| public boolean | readBoolean()
Redeclares java. true if that byte is nonzero,
false if that byte is zero.
|
| public byte | |
| public char | |
| public double | readDouble()
Redeclares java. double value.
|
| public float | readFloat()
Redeclares java. float value.
|
| public void | readFully(byte[]
the buffer into which the data is read. b)Redeclares java. b.
|
| public void | readFully(byte[]
the buffer into which the data is read. b, int an int specifying the offset in the data array off, int b.an int specifying the number of bytes to read. len)Redeclares java. len
bytes from
an input stream.
|
| public int | |
| public String | |
| public long | |
| public short | |
| public int | readUnsignedByte()
Redeclares java. int, and returns
the result, which is therefore in the range
0
through 255.
|
| public int | readUnsignedShort()
Redeclares java. int value in the range 0
through 65535.
|
| public String | readUTF()
Redeclares java. |
| public int | skipBytes(int
the number of bytes to be skipped. n)Redeclares java. n bytes
of data from the input
stream, discarding the skipped bytes.
|
| readBoolean | back to summary |
|---|---|
| public boolean readBoolean() Redeclares java. Doc from java. Reads one input byte and returns
| |
| readByte | back to summary |
|---|---|
| public byte readByte() Redeclares java. Doc from java. Reads and returns one input byte.
The byte is treated as a signed value in
the range
| |
| readChar | back to summary |
|---|---|
| public char readChar() Redeclares java. Doc from java. Reads two input bytes and returns a
This method
is suitable for reading bytes written by
the writeChar method of interface
DataOutput.
| |
| readDouble | back to summary |
|---|---|
| public double readDouble() Redeclares java. Doc from java. Reads eight input bytes and returns
a
| |
| readFloat | back to summary |
|---|---|
| public float readFloat() Redeclares java. Doc from java. Reads four input bytes and returns
a
| |
| readFully | back to summary |
|---|---|
| public void readFully(byte[] b) Redeclares java. Doc from java. Reads some bytes from an input
stream and stores them into the buffer
array This method blocks until one of the following conditions occurs:
If
| |
| readFully | back to summary |
|---|---|
| public void readFully(byte[] b, int off, int len) Redeclares java. Doc from java. Reads This method blocks until one of the following conditions occurs:
If
| |
| readInt | back to summary |
|---|---|
| public int readInt() Redeclares java. Doc from java. Reads four input bytes and returns an
This method is suitable
for reading bytes written by the writeInt
method of interface DataOutput.
| |
| readLine | back to summary |
|---|---|
| public String readLine() Redeclares java. Doc from java. Reads the next line of text from the input stream.
It reads successive bytes, converting
each byte separately into a character,
until it encounters a line terminator or
end of
file; the characters read are then
returned as a
If end of file is encountered
before even one byte can be read, then
| |
| readLong | back to summary |
|---|---|
| public long readLong() Redeclares java. Doc from java. Reads eight input bytes and returns
a
This method is suitable
for reading bytes written by the
| |
| readShort | back to summary |
|---|---|
| public short readShort() Redeclares java. Doc from java. Reads two input bytes and returns
a
This method
is suitable for reading the bytes written
by the writeShort method of
interface DataOutput.
| |
| readUnsignedByte | back to summary |
|---|---|
| public int readUnsignedByte() Redeclares java. Doc from java. Reads one input byte, zero-extends
it to type
| |
| readUnsignedShort | back to summary |
|---|---|
| public int readUnsignedShort() Redeclares java. Doc from java. Reads two input bytes and returns
an
This method is suitable for reading the bytes
written by the writeShort method
of interface DataOutput if
the argument to writeShort
was intended to be a value in the range
0 through 65535.
| |
| readUTF | back to summary |
|---|---|
| public String readUTF() Redeclares java. Doc from java. Reads in a string that has been encoded using a
modified UTF-8
format.
The general contract of
First, two bytes are read and used to
construct an unsigned 16-bit integer in
exactly the manner of the
If the first byte of a group
matches the bit pattern
If the first byte
of a group matches the bit pattern
If the first byte of a group
matches the bit pattern 1110xxxx,
then the group consists of that byte a
and two more bytes b and c.
If there is no byte c (because
byte a was one of the last
two of the bytes to be read), or either
byte b or byte c
does not match the bit pattern 10xxxxxx,
then a UTFDataFormatException
is thrown. Otherwise, the group is converted
to the character:
If the first byte of a group matches the
pattern 1111xxxx or the pattern
10xxxxxx, then a UTFDataFormatException
is thrown.
If end of file is encountered
at any time during this entire process,
then an
After every group has been converted to
a character by this process, the characters
are gathered, in the same order in which
their corresponding groups were read from
the input stream, to form a
The
| |
| skipBytes | back to summary |
|---|---|
| public int skipBytes(int n) Redeclares java. Doc from java. Makes an attempt to skip over
| |