java.io.DataInput
None
java.io.ObjectInput
java.io.DataInputStream, java.io.RandomAccessFile
JDK 1.0 or later
The DataInput interface defines methods for reading primitive data types and lines of text from an input stream in a machine-independent manner. All multibyte quantities are assumed to be in a format that stores the most significant byte as the first byte and the least significant byte as the last byte.
public abstract 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 boolean value read from the stream.
If the end of the file is encountered.
If any other kind of I/O error occurs.
This method reads a byte as a boolean value. A byte that contains a zero is read as false; that which contains a nonzero is read as true.
The byte value read from the stream.
If the end of the file is encountered.
If any other kind of I/O error occurs.
This method reads a signed 8-bit byte.
The char value read from the stream.
If the end of the file is encountered.
If any other kind of I/O error occurs.
This method reads a 16-bit char.
The double value read from the stream.
If the end of the file is encountered.
If any other kind of I/O error occurs.
This method reads a 64-bit double quantity.
The float value read from the stream.
If the end of the file is encountered.
If any other kind of I/O error occurs.
This method reads a 32-bit float quantity.
The array to fill.
If the end of the file is encountered.
If any other kind of I/O error occurs.
This method reads bytes into the given array b until the array is full.
public abstract void readFully(byte[] b, int off, int len) throws IOException
The array to fill.
An offset into the array.
The number of bytes to read.
If the end of the file is encountered.
If any other kind of I/O error occurs.
This method reads len bytes into the given array, starting at offset off.
The int value read from the stream.
If the end of the file is encountered.
If any other kind of I/O error occurs.
This method reads a 32-bit int quantity.
A String that contains the line read from the stream.
If the end of the file is encountered.
If any other kind of I/O error occurs.
This method reads a String from the current position through the next line terminator. Implementations of this method should take care to look for any line terminator: "\n", "\r", or "\r\n".
The long value read from the stream.
If the end of the file is encountered.
If any other kind of I/O error occurs.
This method reads a 64-bit long quantity.
The short value read from the stream.
If the end of the file is encountered.
If any other kind of I/O error occurs.
This method reads a 16-bit short quantity.
The unsigned byte value read from the stream.
If the end of the file is encountered.
If any other kind of I/O error occurs.
This method reads an 8-bit byte as an unsigned quantity.
The unsigned short value read from the stream.
If the end of the file is encountered.
If any other kind of I/O error occurs.
This method reads a 16-bit short as an unsigned quantity.
The String read from the stream.
If the end of the file is encountered.
If any other kind of I/O error occurs.
If the bytes do not represent a valid UTF-8 encoding.
This method reads a UTF-8 format String. See Appendix B, The UTF-8 Encoding, for information on the UTF-8 encoding.
The number of bytes to skip.
The actual number of skipped bytes.
If the end of the file is encountered.
If any other kind of I/O error occurs.
This method skips over n bytes.
DataInputStream, EOFException, IOException, ObjectInput, RandomAccessFile, UTFDataFormatException