Package java.io Previous
Previous
Java API
Java API
Index
Index
Next
Next

Interface DataInput

Methods

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 .


Methods


readBoolean

public abstract boolean readBoolean() 
throws IOException 

Reads a boolean value from the input stream.

Return Value:

Returns the boolean value read.

Throw:

EOFException

If this stream reaches the end before reading all the bytes.

Throw:

IOException

If an I/O error occurs.


readByte

public abstract byte readByte() 
throws IOException 

Reads a signed eight-bit value from the input stream.

Return Value:

Returns the eight-bit value read.

Throw:

EOFException

If this stream reaches the end before reading all the bytes.

Throw:

IOException

If an I/O error occurs.


readChar

public abstract char readChar() 
throws IOException 

Reads a Unicode char value from the input stream.

Return Value:

Returns the Unicode char read

Throw:

EOFException

If this stream reaches the end before reading all the bytes.

Throw:

IOException

If an I/O error occurs.


readDouble

public abstract double readDouble() 
throws IOException 

Reads a double value from the input stream.

Return Value:

Returns the double value read.

Throw:

EOFException

If this stream reaches the end before reading all the bytes.

Throw:

IOException

If an I/O error occurs.


readFloat

public abstract float readFloat() 
throws IOException 

Reads a float value from the input stream, high byte

Return Value:

Returns the float value read.

Throw:

EOFException

If this stream reaches the end before reading all the bytes.

Throw:

IOException

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.

ParameterDescription
b the buffer into which the data is read

Throw:

EOFException

If this stream reaches the end before reading all the bytes.

Throw:

IOException

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.

ParameterDescription
b the buffer into which the data is read

Throw:

EOFException

If this stream reaches the end before reading all the bytes.

Throw:

IOException

If an I/O error occurs.


readInt

public abstract int readInt() 
throws IOException 

Reads an int value from the input stream.

Return Value:

Returns the int value read.

Throw:

EOFException

If this stream reaches the end before reading all the bytes.

Throw:

IOException

If an I/O error occurs.


readLine

public abstract String readLine() 
throws IOException 

Reads the next line of text from the input stream.

Return Value:

Returns If this stream reaches the end before reading all the bytes.

Throw:

IOException

If an I/O error occurs.


readLong

public abstract long readLong() 
throws IOException 

Reads a long value from the input stream.

Return Value:

Returns the long value read.

Throw:

EOFException

If this stream reaches the end before reading all the bytes.

Throw:

IOException

If an I/O error occurs.


readShort

public abstract short readShort() 
throws IOException 

Reads a 16-bit value from the input stream.

Return Value:

Returns the 16-bit value read.

Throw:

EOFException

If this stream reaches the end before reading all the bytes.

Throw:

IOException

If an I/O error occurs.


readUnsignedByte

public abstract int readUnsignedByte() 
throws IOException 

Reads an unsigned eight-bit value from the input stream.

Return Value:

Returns the unsigned eight-bit value read.

Throw:

EOFException

If this stream reaches the end before reading all the bytes.

Throw:

IOException

If an I/O error occurs.


readUnsignedShort

public abstract int readUnsignedShort() 
throws IOException 

Reads an unsigned 16-bit value from the input stream.

Return Value:

Returns the unsigned 16-bit value read.

Throw:

EOFException

If this stream reaches the end before reading all the bytes.

Throw:

IOException

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.

Return Value:

Returns a Unicode string.

Throw:

EOFException

If this stream reaches the end before reading all the bytes.

Throw:

UTFDataFormatException

If the bytes do not represent a valid UTF-8 encoding of a string.

Throw:

IOException

If an I/O error occurs.


skipBytes

public abstract int skipBytes(int  n) 
throws IOException 

Skips exactly n bytes of input.

Return Value:

Returns the number of bytes skipped, which is always n.

ParameterDescription
n the number of bytes to be skipped

Throw:

EOFException

If this stream reaches the end before skipping all the bytes.

Throw:

IOException

If an I/O error occurs.



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