Packages  This Package  Prev  Next  Index  

§2.24 Interface DataInput

public  interface  java.io.DataInput
{
        // Methods
    public abstract boolean readBoolean();	§
    public abstract byte readByte();	§2.24.2
    public abstract char readChar();	§2.24.3
    public abstract double readDouble();	§2.24.4
    public abstract float readFloat();	§2.24.5
    public abstract void readFully(byte  b[]);	§2.24.6
    public abstract void 	§2.24.7
        readFully(byte  b[], int  off, int  len);
    public abstract int readInt();	§2.24.8
    public abstract String readLine();	§2.24.9
    public abstract long readLong();	§2.24.10
    public abstract short readShort();	§2.24.11
    public abstract int readUnsignedByte();	§2.24.12
    public abstract int readUnsignedShort();	§2.24.13
    public abstract String readUTF();	§2.24.14
    public abstract int skipBytes(int  n);	§2.24.15
}
The data input interface is implemented by streams that can read primitive Java data types from a stream in a machine-independent manner.

See Also:
DataInputStream (I-§2.5)
DataOutput (I-§2.25).

Methods

readBoolean

public abstract boolean readBoolean() throws IOException
Reads a boolean value from the input stream.
Returns:
the boolean value read.
Throws
EOFException (I-§2.24)
If this stream reaches the end before reading all the bytes.
Throws
IOException (I-§2.29)
If an I/O error occurs.

readByte

public abstract byte readByte() throws IOException
Reads a signed eight-bit value from the input stream.
Returns:
the eight-bit value read.
Throws
EOFException (I-§2.24)
If this stream reaches the end before reading all the bytes.
Throws
IOException (I-§2.29)
If an I/O error occurs.

readChar

public abstract char readChar() throws IOException
Reads a Unicode char value from the input stream.
Returns:
the Unicode char read
Throws
EOFException (I-§2.24)
If this stream reaches the end before reading all the bytes.
Throws
IOException (I-§2.29)
If an I/O error occurs.

readDouble

public abstract double readDouble() throws IOException
Reads a double value from the input stream.
Returns:
the double value read.
Throws
EOFException (I-§2.24)
If this stream reaches the end before reading all the bytes.
Throws
IOException (I-§2.29)
If an I/O error occurs.

readFloat

public abstract float readFloat() throws IOException
Reads a float value from the input stream, high byte
Returns:
the float value read.
Throws
EOFException (I-§2.24)
If this stream reaches the end before reading all the bytes.
Throws
IOException (I-§2.29)
If an I/O error occurs.

readFully

public abstract void readFully(byte b[]) throws IOException
Reads b.length bytes into the byte array. This method blocks until all the bytes are read.
Parameters:
b - the buffer into which the data is read
Throws
EOFException (I-§2.24)
If this stream reaches the end before reading all the bytes.
Throws
IOException (I-§2.29)
If an I/O error occurs.

readFully

public abstract void readFully(byte b[], int off, int len) throws IOException
Reads b.length bytes into the byte array. This method blocks until all the bytes are read.
Parameters:
b - the buffer into which the data is read
Throws
EOFException (I-§2.24)
If this stream reaches the end before reading all the bytes.
Throws
IOException (I-§2.29)
If an I/O error occurs.

readInt

public abstract int readInt() throws IOException
Reads an int value from the input stream.
Returns:
the int value read.
Throws
EOFException (I-§2.24)
If this stream reaches the end before reading all the bytes.
Throws
IOException (I-§2.29)
If an I/O error occurs.

readLine

public abstract String readLine() throws IOException
Reads the next line of text from the input stream.
Returns:
If this stream reaches the end before reading all the bytes.
Throws
IOException (I-§2.29)
If an I/O error occurs.

readLong

public abstract long readLong() throws IOException
Reads a long value from the input stream.
Returns:
the long value read.
Throws
EOFException (I-§2.24)
If this stream reaches the end before reading all the bytes.
Throws
IOException (I-§2.29)
If an I/O error occurs.

readShort

public abstract short readShort() throws IOException
Reads a 16-bit value from the input stream.
Returns:
the 16-bit value read.
Throws
EOFException (I-§2.24)
If this stream reaches the end before reading all the bytes.
Throws
IOException (I-§2.29)
If an I/O error occurs.

readUnsignedByte

public abstract int readUnsignedByte() throws IOException
Reads an unsigned eight-bit value from the input stream.
Returns:
the unsigned eight-bit value read.
Throws
EOFException (I-§2.24)
If this stream reaches the end before reading all the bytes.
Throws
IOException (I-§2.29)
If an I/O error occurs.

readUnsignedShort

public abstract int readUnsignedShort() throws IOException
Reads an unsigned 16-bit value from the input stream.
Returns:
the unsigned 16-bit value read.
Throws
EOFException (I-§2.24)
If this stream reaches the end before reading all the bytes.
Throws
IOException (I-§2.29)
If an I/O error occurs.

readUTF

public abstract String readUTF() throws IOException
Reads in a string that has been encoded using a modified UTF-8 format.
Returns:
a Unicode string.
Throws
EOFException (I-§2.24)
If this stream reaches the end before reading all the bytes.
Throws
UTFDataFormatException (I-§2.31)
If the bytes do not represent a valid UTF-8 encoding of a string.
Throws
IOException (I-§2.29)
If an I/O error occurs.

skipBytes

public abstract int skipBytes(int n) throws IOException
Skips exactly n bytes of input.
Parameters:
n - the number of bytes to be skipped
Returns:
the number of bytes skipped, which is always n.
Throws
EOFException (I-§2.24)
If this stream reaches the end before skipping all the bytes.
Throws
IOException (I-§2.29)
If an I/O error occurs.

Packages  This Package  Prev  Next  Index
Java API Document (HTML generated by dkramer on April 22, 1996)
Copyright © 1996 Sun Microsystems, Inc. All rights reserved
Please send any comments or corrections to doug.kramer@sun.com