Contents | Prev | Next | Index

22.11 The Class java.io.DataInputStream

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


Contents | Prev | Next | Index

Java Language Specification (HTML generated by Suzette Pelouch on February 24, 1998)
Copyright © 1996 Sun Microsystems, Inc. All rights reserved
Please send any comments or corrections to doug.kramer@sun.com