CHAPTER 22: The Package java.io Previous
Previous
Java Language
Java Language
Index
Index
Next
Next

22.11 The Class java.io.DataInputStream

22.11.1 DataInputStream , 22.11.2 readFully , 22.11.3 readFully , 22.11.4 skipBytes , 22.11.5 readBoolean , 22.11.6 readByte , 22.11.7 readUnsignedByte , 22.11.8 readShort , 22.11.9 readUnsignedShort , 22.11.10 readChar , 22.11.11 readInt , 22.11.12 readLong , 22.11.13 readFloat , 22.11.14 readDouble , 22.11.15 readLine , 22.11.16 readUTF , 22.11.17 readUTF

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;
}


22.11.1 DataInputStream

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 readFully

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.


22.11.3 readFully

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.


22.11.4 skipBytes

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.


22.11.5 readBoolean

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.


22.11.6 readByte

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.


22.11.7 readUnsignedByte

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.


22.11.8 readShort

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.


22.11.9 readUnsignedShort

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.


22.11.10 readChar

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.


22.11.11 readInt

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.


22.11.12 readLong

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.


22.11.13 readFloat

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.


22.11.14 readDouble

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.


22.11.15 readLine

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.


22.11.16 readUTF

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.


22.11.17 readUTF

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).

Top© 1996 Sun Microsystems, Inc. All rights reserved.