Sdílet prostřednictvím


RandomAccessFile.ReadLong Method

Definition

Reads a signed 64-bit integer from this file.

[Android.Runtime.Register("readLong", "()J", "")]
public long ReadLong ();
[<Android.Runtime.Register("readLong", "()J", "")>]
abstract member ReadLong : unit -> int64
override this.ReadLong : unit -> int64

Returns

the next eight bytes of this file, interpreted as a long.

Implements

Attributes

Exceptions

if the end of this file is detected.

if this file is closed or another I/O error occurs.

Remarks

Reads a signed 64-bit integer from this file. This method reads eight bytes from the file, starting at the current file pointer. If the bytes read, in order, are b1, b2, b3, b4, b5, b6, b7, and b8, where: <blockquote>

0 &lt;= b1, b2, b3, b4, b5, b6, b7, b8 &lt;=255,

</blockquote>

then the result is equal to: <blockquote>

((long)b1 &lt;&lt; 56) + ((long)b2 &lt;&lt; 48)
                + ((long)b3 &lt;&lt; 40) + ((long)b4 &lt;&lt; 32)
                + ((long)b5 &lt;&lt; 24) + ((long)b6 &lt;&lt; 16)
                + ((long)b7 &lt;&lt; 8) + b8

</blockquote>

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

Java documentation for java.io.RandomAccessFile.readLong().

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

See also