Skip to content

okio / okio / BufferedSource / readLong

readLong

(js, jvm, native) abstract fun readLong():Long

Removes eight bytes from this source and returns a big-endian long.

Buffer buffer = new Buffer()
    .writeByte(0x7f)
    .writeByte(0xff)
    .writeByte(0xff)
    .writeByte(0xff)
    .writeByte(0xff)
    .writeByte(0xff)
    .writeByte(0xff)
    .writeByte(0xff)
    .writeByte(0x00)
    .writeByte(0x00)
    .writeByte(0x00)
    .writeByte(0x00)
    .writeByte(0x00)
    .writeByte(0x00)
    .writeByte(0x00)
    .writeByte(0x0f);
assertEquals(16, buffer.size());

assertEquals(9223372036854775807L, buffer.readLong());
assertEquals(8, buffer.size());

assertEquals(15, buffer.readLong());
assertEquals(0, buffer.size());