RandomAccessFile.readShort

RandomAccessFile.readShort

Class Overview | Class Members | This Package | All Packages

Syntax
public final short readShort() throws IOException
Returns
the next two bytes of this file, interpreted as a signed 16-bit number.
Description
Reads a signed 16-bit number from this file. The method reads 2 bytes from this file. If the two bytes read, in order, are b1 and b2, where each of the two values is between 0 and 255, inclusive, then the result is equal to:

This method blocks until the two bytes are read, the end of the stream is detected, or an exception is thrown.

Exceptions
EOFException if this file reaches the end before reading two bytes.
Exceptions
IOException if an I/O error occurs.