CHAPTER 22: The Package java.io |
![]() Previous |
![]() Java Language |
![]() Index |
![]() Next |
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 class DataInputStream extends FilterInputStream implements DataInput { public DataInputStream(InputStream in); public final void readFully(byte[] b) throws IOException, NullPointerException; public final void readFully(byte[] b, int off, int len) throws IOException, NullPointerException, IndexOutOfBoundsException; public final int skipBytes(int n) throws IOException; public final boolean readBoolean() throws IOException; public final byte readByte() throws IOException; public final int readUnsignedByte() throws IOException; public final short readShort() throws IOException; public final int readUnsignedShort() throws IOException; public final char readChar() throws IOException; public final int readInt() throws IOException; public final long readLong() throws IOException; public final float readFloat() throws IOException; public final double readDouble() throws IOException; public final String readLine() throws IOException; public final String readUTF() throws IOException; public final static String readUTF(DataInput in) throws IOException; }
public DataInputStream(InputStream in)
This constructor initializes a newly created DataInputStream by saving its argument, the input stream in, for later use.
public final void readFully(byte[] b) throws IOException, NullPointerException
See the general contract of the readFully method of DataInput (S22.1.1).
Bytes for this operation are read from the contained input stream.
public final void readFully(byte[] b, int off, int len) throws IOException, NullPointerException, IndexOutOfBoundsException
See the general contract of the readFully method of DataInput (S22.1.2).
Bytes for this operation are read from the contained input stream.
public final int skipBytes(int n) throws IOException
See the general contract of the skipBytes method of DataInput (S22.1.3).
Bytes for this operation are read from the contained input stream.
public final boolean readBoolean() throws IOException
See the general contract of the readBoolean method of DataInput (S22.1.4).
The byte for this operation is read from the contained input stream.
public final byte readByte() throws IOException
See the general contract of the readByte method of DataInput (S22.1.5).
The byte for this operation is read from the contained input stream.
public final int readUnsignedByte() throws IOException
See the general contract of the readUnsignedByte method of DataInput (S22.1.6).
The byte for this operation is read from the contained input stream.
public final short readShort() throws IOException
See the general contract of the readShort method of DataInput (S22.1.7).
Bytes for this operation are read from the contained input stream.
public final int readUnsignedShort() throws IOException
See the general contract of the readUnsignedShort method of DataInput (S22.1.8).
Bytes for this operation are read from the contained input stream.
public final char readChar() throws IOException
See the general contract of the readChar method of DataInput (S22.1.9).
Bytes for this operation are read from the contained input stream.
public final int readInt() throws IOException
See the general contract of the readInt method of DataInput (S22.1.10).
Bytes for this operation are read from the contained input stream.
public final long readLong() throws IOException
See the general contract of the readLong method of DataInput (S22.1.11).
Bytes for this operation are read from the contained input stream.
public final float readFloat() throws IOException
See the general contract of the readFloat method of DataInput (S22.1.12).
Bytes for this operation are read from the contained input stream.
public final double readDouble() throws IOException
See the general contract of the readDouble method of DataInput (S22.1.13).
Bytes for this operation are read from the contained input stream.
public final String readLine() throws IOException
See the general contract of the readLine method of DataInput (S22.1.14).
Bytes for this operation are read from the contained input stream.
public final String readUTF() throws IOException
See the general contract of the readUTF method of DataInput (S22.1.15).
Bytes for this operation are read from the contained input stream.
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 (S22.1.15).