站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > JDK 5 Documentation v1.1.8, Java 2 SDK 英文文档

Interface java.io.DataInput - JDK 5 Documentation v1.1.8, Java 2 SDK 英文文档

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

Method Index

 o readBoolean()
Reads a boolean value from the input stream.
 o readByte()
Reads a signed 8-bit value from the input stream.
 o readChar()
Reads a Unicode char value from the input stream.
 o readDouble()
Reads a double value from the input stream.
 o readFloat()
Reads a float value from the input stream.
 o readFully(byte[])
Reads b.length bytes into the byte array.
 o readFully(byte[], int, int)
Reads b.length bytes into the byte array.
 o readInt()
Reads an int value from the input stream.
 o readLine()
Reads the next line of text from the input stream.
 o readLong()
Reads a long value from the input stream.
 o readShort()
Reads a 16-bit value from the input stream.
 o readUnsignedByte()
Reads an unsigned 8-bit value from the input stream.
 o readUnsignedShort()
Reads an unsigned 16-bit value from the input stream.
 o readUTF()
Reads in a string that has been encoded using a modified UTF-8 format.
 o skipBytes(int)
Skips exactly n bytes of input.

Methods

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