A data input stream provides facilities for reading bytes from an input source and interpreting specific character sequences as representing data of diverse types.
public classDataInputStream
extends FilterInputStream implements DataInput { publicDataInputStream
(InputStream in); public final voidreadFully
(byte[] b) throws IOException, NullPointerException; public final voidreadFully
(byte[] b, int off, int len) throws IOException, NullPointerException, IndexOutOfBoundsException; public final intskipBytes
(int n) throws IOException; public final booleanreadBoolean
() throws IOException; public final bytereadByte
() throws IOException; public final intreadUnsignedByte
() throws IOException; public final shortreadShort
() throws IOException; public final intreadUnsignedShort
() throws IOException; public final charreadChar
() throws IOException; public final intreadInt
() throws IOException; public final longreadLong
() throws IOException; public final floatreadFloat
() throws IOException; public final doublereadDouble
() throws IOException; public final StringreadLine
() throws IOException; public final StringreadUTF
() throws IOException; public final static StringreadUTF
(DataInput in) throws IOException; }
22.11.1 public DataInputStream(InputStream in)
This constructor initializes a newly created DataInputStream
by saving its argument, the input stream in
, for later use.
22.11.2 public final void readFully(byte[] b)
throws IOException, NullPointerException
See the general contract of the readFully
method of DataInput
(§22.1.1).
Bytes for this operation are read from the contained input stream.
22.11.3 public final void readFully(byte[] b, int off, int len)
throws IOException, NullPointerException, IndexOutOfBoundsException
See the general contract of the readFully
method of DataInput
(§22.1.2).
Bytes for this operation are read from the contained input stream.
22.11.4 public final int skipBytes(int n) throws IOException
See the general contract of the skipBytes
method of DataInput
(§22.1.3).
Bytes for this operation are read from the contained input stream.
22.11.5 public final boolean readBoolean() throws IOException
See the general contract of the readBoolean
method of DataInput
(§22.1.4).
The byte for this operation is read from the contained input stream.
22.11.6 public final byte readByte() throws IOException
See the general contract of the readByte
method of DataInput
(§22.1.5).
The byte for this operation is read from the contained input stream.
22.11.7 public final int readUnsignedByte() throws IOException
See the general contract of the readUnsignedByte
method of DataInput
(§22.1.6).
The byte for this operation is read from the contained input stream.
22.11.8 public final short readShort() throws IOException
See the general contract of the readShort
method of DataInput
(§22.1.7).
Bytes for this operation are read from the contained input stream.
22.11.9 public final int readUnsignedShort() throws IOException
See the general contract of the readUnsignedShort
method of DataInput
(§22.1.8).
Bytes for this operation are read from the contained input stream.
22.11.10 public final char readChar() throws IOException
See the general contract of the readChar
method of DataInput
(§22.1.9).
Bytes for this operation are read from the contained input stream.
22.11.11 public final int readInt() throws IOException
See the general contract of the readInt
method of DataInput
(§22.1.10).
Bytes for this operation are read from the contained input stream.
22.11.12 public final long readLong() throws IOException
See the general contract of the readLong
method of DataInput
(§22.1.11).
Bytes for this operation are read from the contained input stream.
22.11.13 public final float readFloat() throws IOException
See the general contract of the readFloat
method of DataInput
(§22.1.12).
Bytes for this operation are read from the contained input stream.
22.11.14 public final double readDouble() throws IOException
See the general contract of the readDouble
method of DataInput
(§22.1.13).
Bytes for this operation are read from the contained input stream.
22.11.15 public final String readLine() throws IOException
See the general contract of the readLine
method of DataInput
(§22.1.14).
Bytes for this operation are read from the contained input stream.
22.11.16 public final String readUTF() throws IOException
See the general contract of the readUTF
method of DataInput
(§22.1.15).
Bytes for this operation are read from the contained input stream.
22.11.17 public final static String readUTF(DataInput in)
throws IOException
The readUTF
method reads from the stream in
a representation of a Unicode
character string encoded in Java modified UTF-8 format; this string of characters
is then returned as a String
. The details of the modified UTF-8 representation are
exactly the same as for the readUTF
method of DataInput
(§22.1.15).