public class DataInput extends Object
| Constructor and Description |
|---|
DataInput(InputStream in)
Create a DataInput class instance using by native order.
|
DataInput(InputStream in,
ByteOrder endian)
Create a DataInput class instance.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
int |
getCount() |
int |
readByte()
Reads the next one byte of this input stream as a signed 8-bit integer.
|
byte[] |
readBytes(int n) |
int |
readInt16()
Reads the next two bytes of this input stream as a signed 16-bit integer.
|
int |
readInt32()
Reads the next four bytes of this input stream as a signed 32-bit integer.
|
int |
readUint16()
Reads the next two bytes of this input stream as a unsigned 16-bit integer.
|
long |
readUint32()
Reads the next four bytes of this input stream as a unsigned 32-bit integer.
|
void |
setCount(int count) |
public DataInput(InputStream in)
in - the input stream that had better buffer by a BufferedInputStream.public DataInput(InputStream in, ByteOrder endian)
in - the input stream that had better buffer by a BufferedInputStream.endian - the endian of the input streampublic int readByte()
throws IOException,
EOFException
int value as a signed 8-bit integer.IOException - if an I/O error occurs.EOFException - if this stream reaches the end before reading all the bytes.public int readInt16()
throws IOException,
EOFException
int value as a signed 16-bit integer.IOException - if an I/O error occurs.EOFException - if this stream reaches the end before reading all the bytes.public int readInt32()
throws IOException,
EOFException
int value as a signed 32-bit integer.IOException - if an I/O error occurs.EOFException - if this stream reaches the end before reading all the bytes.public int readUint16()
throws IOException,
EOFException
int value as a unsigned 16-bit integer.IOException - if an I/O error occurs.EOFException - if this stream reaches the end before reading all the bytes.public long readUint32()
throws IOException,
EOFException
long value as a unsigned 32-bit integer.IOException - if an I/O error occurs.EOFException - if this stream reaches the end before reading all the bytes.public byte[] readBytes(int n)
throws IOException,
EOFException
IOExceptionEOFExceptionpublic void setCount(int count)
public int getCount()
public void close()