|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.io.InputStream | +--java.io.FilterInputStream | +--java.io.DataInputStream
A data input stream that lets you read primitive Java data types from a stream in a portable way. Primitive data types are well understood types with associated operations. For example, Integers are considered primitive data types.
DataOutputStream
Field Summary |
Fields inherited from class java.io.FilterInputStream |
in |
Constructor Summary | |
DataInputStream(InputStream in)
Creates a new DataInputStream. |
Method Summary | |
int |
read(byte[] b)
Reads data into an array of bytes. |
int |
read(byte[] b,
int off,
int len)
Reads data into an array of bytes. |
boolean |
readBoolean()
Reads a boolean. |
byte |
readByte()
Reads an 8 bit byte. |
char |
readChar()
Reads a 16 bit char. |
double |
readDouble()
Reads a 64 bit double. |
float |
readFloat()
Reads a 32 bit float. |
void |
readFully(byte[] b)
Reads bytes, blocking until all bytes are read. |
void |
readFully(byte[] b,
int off,
int len)
Reads bytes, blocking until all bytes are read. |
int |
readInt()
Reads a 32 bit int. |
String |
readLine()
Reads in a line that has been terminated by a \n, \r, \r\n or EOF. |
long |
readLong()
Reads a 64 bit long. |
short |
readShort()
Reads a 16 bit short. |
int |
readUnsignedByte()
Reads an unsigned 8 bit byte. |
int |
readUnsignedShort()
Reads 16 bit short. |
String |
readUTF()
Reads a UTF format String. |
static String |
readUTF(DataInput in)
Reads a UTF format String from the given input stream. |
int |
skipBytes(int n)
Skips bytes, blocks until all bytes are skipped. |
Methods inherited from class java.io.FilterInputStream |
available, close, mark, markSupported, read, reset, skip |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public DataInputStream(InputStream in)
in
- the input streamMethod Detail |
public final int read(byte[] b) throws IOException
read
in class FilterInputStream
b
- the buffer into which the data is read
IOException
- If an I/O error has occurred.public final int read(byte[] b, int off, int len) throws IOException
read
in class FilterInputStream
b
- the buffer into which the data is readoff
- the start offset of the datalen
- the maximum number of bytes read
IOException
- If an I/O error has occurred.public final void readFully(byte[] b) throws IOException
readFully
in interface DataInput
b
- the buffer into which the data is read
IOException
- If an I/O error has occurred.
EOFException
- If EOF reached before all bytes are read.public final void readFully(byte[] b, int off, int len) throws IOException
readFully
in interface DataInput
b
- the buffer into which the data is readoff
- the start offset of the datalen
- the maximum number of bytes read
IOException
- If an I/O error has occurred.
EOFException
- If EOF reached before all bytes are read.public final int skipBytes(int n) throws IOException
skipBytes
in interface DataInput
n
- the number of bytes to be skipped
IOException
- If an I/O error has occurred.public final boolean readBoolean() throws IOException
readBoolean
in interface DataInput
IOException
- If other I/O error has occurred.public final byte readByte() throws IOException
readByte
in interface DataInput
IOException
- If other I/O error has occurred.public final int readUnsignedByte() throws IOException
readUnsignedByte
in interface DataInput
IOException
- If other I/O error has occurred.public final short readShort() throws IOException
readShort
in interface DataInput
IOException
- If other I/O error has occurred.public final int readUnsignedShort() throws IOException
readUnsignedShort
in interface DataInput
IOException
- If other I/O error has occurred.public final char readChar() throws IOException
readChar
in interface DataInput
IOException
- If other I/O error has occurred.public final int readInt() throws IOException
readInt
in interface DataInput
IOException
- If other I/O error has occurred.public final long readLong() throws IOException
readLong
in interface DataInput
IOException
- If other I/O error has occurred.public final float readFloat() throws IOException
readFloat
in interface DataInput
IOException
- If other I/O error has occurred.public final double readDouble() throws IOException
readDouble
in interface DataInput
IOException
- If other I/O error has occurred.public final String readLine() throws IOException
readLine
in interface DataInput
IOException
public final String readUTF() throws IOException
readUTF
in interface DataInput
IOException
public static final String readUTF(DataInput in) throws IOException
IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |