An abstract implementation that implements the floating point methods in terms of integer methods.
Buf represents a fixed, immutable byte buffer with efficient positional access.
A ByteWriter
that results in an owned Buf
A ByteReader provides a stateful API to extract bytes from an underlying buffer, which in most cases is a Buf.
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.
ByteWriters allow efficient encoding to a buffer.
ByteWriters allow efficient encoding to a buffer. Concatenating
Bufs together is a common pattern for codecs (especially on the encode
path), but using the concat
method on Buf results in a suboptimal
representation. In many cases, a ByteWriter not only allows for a more
optimal representation (i.e., sequential accessible out regions), but also
allows for writes to avoid allocations. What this means in practice is that
builders are stateful. Assume that the builder implementations are ""not""
threadsafe unless otherwise noted.
Provides the Reader API for an InputStream
.
Provides the Reader API for an InputStream
.
The given InputStream
will be closed when Reader.read
reaches the EOF or a call to discard() or close().
A Reader represents a stream of bytes, read in discrete chunks.
A Reader represents a stream of bytes, read in discrete chunks. Readers permit at most one outstanding read.
A Writer represents a sink for a stream of bytes, providing a convenient interface for the producer of such streams.
Buf wrapper-types (like Buf.ByteArray and Buf.ByteBuffer) provide Shared and Owned APIs, each of which with construction & extraction utilities.
Buf wrapper-types (like Buf.ByteArray and Buf.ByteBuffer) provide Shared and Owned APIs, each of which with construction & extraction utilities.
The Owned APIs may provide direct access to a Buf's underlying implementation; and so mutating the data structure invalidates a Buf's immutability constraint. Users must take care to handle this data immutably.
The Shared variants, on the other hand, ensure that the Buf shares no state with the caller (at the cost of additional allocation).
Note: There are Java-friendly APIs for this object at com.twitter.io.Bufs
.
A set of java.nio.charset.Charset utilities.
Utilities for working with java.io.File
s
Writers for Java friendly APIs.
Buf represents a fixed, immutable byte buffer with efficient positional access. Buffers may be sliced and concatenated, and thus be used to implement bytestreams.
com.twitter.io.Buf.Empty for an empty
Buf
.com.twitter.io.Buf.apply for creating a
Buf
from otherBufs
com.twitter.io.Buf.ByteBuffer for an
nio.ByteBuffer
backed implementation.com.twitter.io.Buf.ByteArray for an
Array[Byte]
backed implementation.