Process the underlying buffer 1-byte at a time using the given
Buf.Processor, starting at index from
of the underlying buffer until
index until
of the underlying buffer.
Process the underlying buffer 1-byte at a time using the given
Buf.Processor, starting at index from
of the underlying buffer until
index until
of the underlying buffer. Processing will halt if the processor
returns false
or after processing the final byte.
the starting index, inclusive. Must be non-negative.
the ending index, exclusive. Must be non-negative.
-1 if the processor processed all bytes or
the last processed index if the processor returns
false
.
Will return -1 if from
is greater than or equal to
until
or length
of the underlying buffer.
Will return -1 if until
is greater than or equal to
length
of the underlying buffer.
this does not advance the byte cursor.
Process the underlying buffer 1-byte at a time using the given
Buf.Processor, starting at index 0
of the underlying buffer until
index length
of the underlying buffer.
Process the underlying buffer 1-byte at a time using the given
Buf.Processor, starting at index 0
of the underlying buffer until
index length
of the underlying buffer. Processing will halt if the processor
returns false
or after processing the final byte.
-1 if the processor processed all bytes or
the last processed index if the processor returns
false
.
this does not advance the byte cursor.
Like read
, but extracts the remainder of bytes from cursor
to the length.
Like read
, but extracts the remainder of bytes from cursor
to the length. Note, this advances the cursor to the end of
the buf.
Extract 8 bits and interpret as a signed integer, advancing the byte cursor by 1.
Returns a new buffer representing a slice of this buffer, delimited
by the indices [cursor, remaining)
.
Returns a new buffer representing a slice of this buffer, delimited
by the indices [cursor, remaining)
. Out of bounds indices are truncated.
Negative indices are not accepted.
Extract 64 bits and interpret as a big endian floating point, advancing the byte cursor by 4.
Extract 64 bits and interpret as a little endian floating point, advancing the byte cursor by 4.
Extract 32 bits and interpret as a big endian floating point, advancing the byte cursor by 4.
Extract 32 bits and interpret as a little endian floating point, advancing the byte cursor by 4.
Extract 32 bits and interpret as a big endian integer, advancing the byte cursor by 4.
Extract 32 bits and interpret as a little endian int, advancing the byte cursor by 4.
Extract 64 bits and interpret as a big endian integer, advancing the byte cursor by 8.
Extract 64 bits and interpret as a little endian integer, advancing the byte cursor by 8.
Extract 24 bits and interpret as a big endian integer, advancing the byte cursor by 3.
Extract 24 bits and interpret as a little endian integer, advancing the byte cursor by 3.
Extract 16 bits and interpret as a big endian integer, advancing the byte cursor by 2.
Extract 16 bits and interpret as a little endian integer, advancing the byte cursor by 2.
Extract exactly the specified number of bytes into a String
using the
specified Charset
, advancing the byte cursor by bytes
.
Extract exactly the specified number of bytes into a String
using the
specified Charset
, advancing the byte cursor by bytes
.
UnderflowException
if there are < bytes
bytes available
Extract 8 bits and interpret as an unsigned integer, advancing the byte cursor by 1.
Extract 32 bits and interpret as a big endian unsigned integer, advancing the byte cursor by 4.
Extract 32 bits and interpret as a little endian unsigned integer, advancing the byte cursor by 4.
Extract 64 bits and interpret as a big endian unsigned integer, advancing the byte cursor by 8.
Extract 64 bits and interpret as a little endian unsigned integer, advancing the byte cursor by 8.
Extract 24 bits and interpret as a big endian unsigned integer, advancing the byte cursor by 3.
Extract 24 bits and interpret as a little endian unsigned integer, advancing the byte cursor by 3.
Extract 16 bits and interpret as a big endian unsigned integer, advancing the byte cursor by 2.
Extract 16 bits and interpret as a little endian unsigned integer, advancing the byte cursor by 2.
The remainder of bytes that the reader is capable of reading.
The remainder of bytes until the first occurrence of byte
(exclusive).
The remainder of bytes until the first occurrence of byte
(exclusive).
Returns -1
when byte
is not found on the underlying resource.
All util and finagle Buf implementations will not copy onto the heap, but for other implementations, it may trigger a copy.
Skip over the next n
bytes.
Skip over the next n
bytes.
UnderflowException
if there are < n
bytes available
A ByteReader provides a stateful API to extract bytes from an underlying buffer, which in most cases is a Buf. This conveniently allows codec implementations to decode frames, specifically when they need to decode and interpret the bytes as a numeric value.
Unless otherwise stated, ByteReader implementations are not thread safe.