java.lang.Object | |||
↳ | java.io.InputStream | ||
↳ | java.io.FilterInputStream | ||
↳ | java.io.DataInputStream |
Wraps an existing
InputStream
and reads big-endian 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 up to
byteCount
bytes from this stream and stores them in
the byte array
buffer
starting at
byteOffset
.
|
||||||||||
|
Equivalent to
read(buffer, 0, buffer.length)
.
|
||||||||||
|
Reads a boolean.
|
||||||||||
|
Reads an 8-bit byte value.
|
||||||||||
|
Reads a big-endian 16-bit character value.
|
||||||||||
|
Reads a big-endian 64-bit double value.
|
||||||||||
|
Reads a big-endian 32-bit float value.
|
||||||||||
|
Equivalent to
readFully(dst, 0, dst.length);
.
|
||||||||||
|
Reads
byteCount
bytes from this stream and stores them in the byte
array
dst
starting at
offset
.
|
||||||||||
|
Reads a big-endian 32-bit integer value.
|
||||||||||
|
This method was deprecated
in API level 1.
This method cannot be trusted to convert bytes to characters correctly.
Wrap this stream with a
BufferedReader
instead.
|
||||||||||
|
Reads a big-endian 64-bit long value.
|
||||||||||
|
Reads a big-endian 16-bit short value.
|
||||||||||
|
|
||||||||||
|
Reads a string encoded with
modified UTF-8
.
|
||||||||||
|
Reads an unsigned 8-bit byte value and returns it as an int.
|
||||||||||
|
Reads a big-endian 16-bit unsigned short value 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
|
|||||||||||
From interface
java.lang.AutoCloseable
|
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.
Warning:
passing a null source creates an invalid
DataInputStream
. All operations on such a stream will fail.
in | the source InputStream the filter reads from. |
---|
Reads up to
byteCount
bytes from this stream and stores them in
the byte array
buffer
starting at
byteOffset
.
Returns the number of bytes actually read or -1 if the end of the stream
has been reached.
IOException |
---|
Equivalent to
read(buffer, 0, buffer.length)
.
IOException |
---|
Equivalent to
readFully(dst, 0, dst.length);
.
IOException |
---|
Reads
byteCount
bytes from this stream and stores them in the byte
array
dst
starting at
offset
. If
byteCount
is zero, then this
method returns without reading any bytes. Otherwise, this method blocks until
byteCount
bytes have been read. If insufficient bytes are available,
EOFException
is thrown. If an I/O error occurs,
IOException
is
thrown. When an exception is thrown, some bytes may have been consumed from the stream
and written into the array.
dst | the byte array into which the data is read. |
---|---|
offset |
the offset in
dst
at which to store the bytes.
|
byteCount | the number of bytes to read. |
IOException |
---|
This method was deprecated
in API level 1.
This method cannot be trusted to convert bytes to characters correctly.
Wrap this stream with a
BufferedReader
instead.
Returns a string containing the next line of text available from this
stream. A line is made of zero or more characters followed by
'\n'
,
'\r'
,
"\r\n"
or the end of the stream. The string
does not include the newline sequence.
IOException |
---|
Reads a string encoded with
modified UTF-8
.
modified UTF-8
.
IOException |
---|
Reads an unsigned 8-bit byte value and returns it as an int.
IOException |
---|
Reads a big-endian 16-bit unsigned short value and returns it as an int.
IOException |
---|
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. |
---|