All Packages Class Hierarchy This Package Previous Next Index
Interface java.io.DataInput
- public interface DataInput
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
-
readBoolean()
- Reads a
boolean
value from the input stream.
-
readByte()
- Reads a signed 8-bit value from the input stream.
-
readChar()
- Reads a Unicode
char
value from the input stream.
-
readDouble()
- Reads a
double
value from the input stream.
-
readFloat()
- Reads a
float
value from the input stream.
-
readFully(byte[])
- Reads
b.length
bytes into the byte array.
-
readFully(byte[], int, int)
- Reads
b.length
bytes into the byte array.
-
readInt()
- Reads an
int
value from the input stream.
-
readLine()
- Reads the next line of text from the input stream.
-
readLong()
- Reads a
long
value from the input stream.
-
readShort()
- Reads a 16-bit value from the input stream.
-
readUnsignedByte()
- Reads an unsigned 8-bit value from the input stream.
-
readUnsignedShort()
- Reads an unsigned 16-bit value from the input stream.
-
readUTF()
- Reads in a string that has been encoded using a modified UTF-8 format.
-
skipBytes(int)
- Skips exactly
n
bytes of input.
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
- if this stream reaches the end before reading
all the bytes.
- Throws: 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.
- Parameters:
- b - the buffer into which the data is read.
- Throws: EOFException
- if this stream reaches the end before reading
all the bytes.
- Throws: IOException
- 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
- if this stream reaches the end before skipping
all the bytes.
- Throws: IOException
- if an I/O error occurs.
readBoolean
public abstract boolean readBoolean() throws IOException
- Reads a
boolean
value from the input stream.
- Returns:
- the
boolean
value read.
- Throws: EOFException
- if this stream reaches the end before reading
all the bytes.
- Throws: IOException
- if an I/O error occurs.
readByte
public abstract byte readByte() throws IOException
- Reads a signed 8-bit value from the input stream.
- Returns:
- the 8-bit value read.
- Throws: EOFException
- if this stream reaches the end before reading
all the bytes.
- Throws: IOException
- if an I/O error occurs.
readUnsignedByte
public abstract int readUnsignedByte() throws IOException
- Reads an unsigned 8-bit value from the input stream.
- Returns:
- the unsigned 8-bit value read.
- Throws: EOFException
- if this stream reaches the end before reading
all the bytes.
- Throws: IOException
- 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
- if this stream reaches the end before reading
all the bytes.
- Throws: IOException
- 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
- if this stream reaches the end before reading
all the bytes.
- Throws: IOException
- 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
- if this stream reaches the end before reading
all the bytes.
- Throws: IOException
- 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
- if this stream reaches the end before reading
all the bytes.
- Throws: IOException
- 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
- if this stream reaches the end before reading
all the bytes.
- Throws: IOException
- if an I/O error occurs.
readFloat
public abstract float readFloat() throws IOException
- Reads a
float
value from the input stream.
- Returns:
- the
float
value read.
- Throws: EOFException
- if this stream reaches the end before reading
all the bytes.
- Throws: IOException
- 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
- if this stream reaches the end before reading
all the bytes.
- Throws: IOException
- 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
- 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.
For an exact description of this method, see the discussion in
Gosling, Joy, and Steele, The Java Language Specification.
- Returns:
- a Unicode string.
- Throws: EOFException
- if this stream reaches the end
before reading all the bytes.
- Throws: IOException
- if an I/O error occurs.
- Throws: UTFDataFormatException
- if the bytes do not represent a
valid UTF-8 encoding of a string.
All Packages Class Hierarchy This Package Previous Next Index
Submit a bug or feature - Version 1.1.8 of Java Platform API Specification
Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries.
Copyright 1995-1999 Sun Microsystems, Inc. 901 San Antonio Road,
Palo Alto, California, 94303, U.S.A. All Rights Reserved.