Write 8 bits of b
.
Write 8 bits of b
. The remaining 24 bits are ignored.
Write all the bytes from buf
into the running buffer.
Write all the bytes from bs
into the running buffer.
Write 64 bits from d
in big-endian order.
Write 64 bits from d
in little-endian order.
Write 32 bits from f
in big-endian order.
Write 32 bits from f
in little-endian order.
Write 32 bits from i
in big-endian order.
Write 32 bits from i
in little-endian order.
Write 64 bits from l
in big-endian order.
Write 64 bits from l
in little-endian order.
Write 24 bits from m
in big-endian order.
Write 24 bits from m
in big-endian order. The remaining
8 bits are ignored.
Write 24 bits from m
in little-endian order.
Write 24 bits from m
in little-endian order. The remaining
8 bits are ignored.
Write 16 bits from s
in big-endian order.
Write 16 bits from s
in big-endian order. The remaining
16 bits are ignored.
Write 16 bits from s
in little-endian order.
Write 16 bits from s
in little-endian order. The remaining
16 bits are ignored.
Write the byte representation of string
, encoded using the specified Charset
into the running 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.