Package java.io |
![]() Previous |
![]() Java API |
![]() Index |
![]() Next |
public interface java.io.DataInput { // Methods public abstract boolean readBoolean(); public abstract byte readByte(); public abstract char readChar(); public abstract double readDouble(); public abstract float readFloat(); public abstract void readFully(byte b[]); public abstract void readFully(byte b[], int off, int len); public abstract int readInt(); public abstract String readLine(); public abstract long readLong(); public abstract short readShort(); public abstract int readUnsignedByte(); public abstract int readUnsignedShort(); public abstract String readUTF(); public abstract int skipBytes(int n); }
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 DataOutput . |
public abstract boolean readBoolean()throws IOExceptionReads a boolean value from the input stream.
Return Value:
Returns the boolean value read.
Throw:
If this stream reaches the end before reading all the bytes.
Throw:
If an I/O error occurs.
public abstract byte readByte()throws IOExceptionReads a signed eight-bit value from the input stream.
Return Value:
Returns the eight-bit value read.
Throw:
If this stream reaches the end before reading all the bytes.
Throw:
If an I/O error occurs.
public abstract char readChar()throws IOExceptionReads a Unicode char value from the input stream.
Return Value:
Returns the Unicode char read
Throw:
If this stream reaches the end before reading all the bytes.
Throw:
If an I/O error occurs.
public abstract double readDouble()throws IOExceptionReads a double value from the input stream.
Return Value:
Returns the double value read.
Throw:
If this stream reaches the end before reading all the bytes.
Throw:
If an I/O error occurs.
public abstract float readFloat()throws IOExceptionReads a float value from the input stream, high byte
Return Value:
Returns the float value read.
Throw:
If this stream reaches the end before reading all the bytes.
Throw:
If an I/O error occurs.
public abstract void readFully(byte b[])throws IOExceptionReads b.length bytes into the byte array. This method blocks until all the bytes are read.
Parameter Description b the buffer into which the data is read Throw:
If this stream reaches the end before reading all the bytes.
Throw:
If an I/O error occurs.
public abstract void readFully(byte b[], int off, int len)throws IOExceptionReads b.length bytes into the byte array. This method blocks until all the bytes are read.
Parameter Description b the buffer into which the data is read Throw:
If this stream reaches the end before reading all the bytes.
Throw:
If an I/O error occurs.
public abstract int readInt()throws IOExceptionReads an int value from the input stream.
Return Value:
Returns the int value read.
Throw:
If this stream reaches the end before reading all the bytes.
Throw:
If an I/O error occurs.
public abstract String readLine()throws IOExceptionReads the next line of text from the input stream.
Return Value:
Returns If this stream reaches the end before reading all the bytes.
Throw:
If an I/O error occurs.
public abstract long readLong()throws IOExceptionReads a long value from the input stream.
Return Value:
Returns the long value read.
Throw:
If this stream reaches the end before reading all the bytes.
Throw:
If an I/O error occurs.
public abstract short readShort()throws IOExceptionReads a 16-bit value from the input stream.
Return Value:
Returns the 16-bit value read.
Throw:
If this stream reaches the end before reading all the bytes.
Throw:
If an I/O error occurs.
public abstract int readUnsignedByte()throws IOExceptionReads an unsigned eight-bit value from the input stream.
Return Value:
Returns the unsigned eight-bit value read.
Throw:
If this stream reaches the end before reading all the bytes.
Throw:
If an I/O error occurs.
public abstract int readUnsignedShort()throws IOExceptionReads an unsigned 16-bit value from the input stream.
Return Value:
Returns the unsigned 16-bit value read.
Throw:
If this stream reaches the end before reading all the bytes.
Throw:
If an I/O error occurs.
public abstract String readUTF()throws IOExceptionReads in a string that has been encoded using a modified UTF-8 format.
Return Value:
Returns a Unicode string.
Throw:
If this stream reaches the end before reading all the bytes.
Throw:
If the bytes do not represent a valid UTF-8 encoding of a string.
Throw:
If an I/O error occurs.
public abstract int skipBytes(int n)throws IOExceptionSkips exactly n bytes of input.
Return Value:
Returns the number of bytes skipped, which is always n.
Parameter Description n the number of bytes to be skipped Throw:
If this stream reaches the end before skipping all the bytes.
Throw:
If an I/O error occurs.