Skip to content

okio / okio / BufferedSource / readHexadecimalUnsignedLong

readHexadecimalUnsignedLong

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

Reads a long form this source in hexadecimal form (i.e., as a string in base 16). This will iterate until a non-hexadecimal character is found.

Buffer buffer = new Buffer()
    .writeUtf8("ffff CAFEBABE 10");

assertEquals(65535L, buffer.readHexadecimalUnsignedLong());
assertEquals(' ', buffer.readByte());
assertEquals(0xcafebabeL, buffer.readHexadecimalUnsignedLong());
assertEquals(' ', buffer.readByte());
assertEquals(0x10L, buffer.readHexadecimalUnsignedLong());

Exceptions

NumberFormatException - if the found hexadecimal does not fit into a long or hexadecimal was not found.