The number of bytes in the buffer
Returns a new buffer representing a slice of this buffer, delimited
by the indices from
inclusive and until
exclusive: [from, until)
.
Returns a new buffer representing a slice of this buffer, delimited
by the indices from
inclusive and until
exclusive: [from, until)
.
Out of bounds indices are truncated. Negative indices are not accepted.
Helper to support 0-copy coercion to Buf.ByteArray.
Helper to support 0-copy coercion to Buf.ByteArray.
Write the entire contents of the buffer into the given array at the given offset.
Write the entire contents of the buffer into the given array at the given offset. Partial writes aren't supported directly through this API; they easily performed by first slicing the buffer.
IllegalArgumentException
when output
is too small to
contain all the data.
Concatenate this buffer with the given buffer.
Definitely requires copying.
Definitely requires copying.
May require copying.
May require copying.
Buf represents a fixed, immutable byte buffer. Buffers may be sliced and concatenated, and thus be used to implement bytestreams.
Note: There is a Java-friendly API for this trait: com.twitter.io.AbstractBuf.