RandomAccessFile.readLong
Class Overview | Class Members |
This Package |
All Packages
public final long readLong() throws IOException
Returns
the next eight bytes of this file, interpreted as a
long.
Description
Reads a signed 64-bit integer from this file. This method reads eight
bytes from the file. If the bytes read, in order, are
b1, b2, b3,
b4, b5, b6,
b7, and b8, where:
0 <= b1, b2, b3, b4, b5, b6, b7, b8 <=255,
then the result is equal to:
((long)b1 << 56) + ((long)b2 << 48)
+ ((long)b3 << 40) + ((long)b4 << 32)
+ ((long)b5 << 24) + ((long)b6 << 16)
+ ((long)b7 << 8) + b8
This method blocks until the eight 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
eight bytes.
Exceptions
IOException
if an I/O error occurs.