Returns the exact encoded size of a
.
Returns an upper bound on the size of a
.
Returns a lower bound on the space required in a buffer so that a
can
be written.
Reads a value of type A
from buffer
.
This is similar to read(buffer)
, except that a value does not actually
need to be returned.
Writes a
using a ByteBufferMonad
.
Writes a
using a ByteBufferMonad
. This is much slower than just using
writeInit/writeMore.
Writes a
entirely to a series of ByteBuffer
s returned by acquire
.
Writes a
entirely to a series of ByteBuffer
s returned by acquire
.
The returned set of ByteBuffer
s is in reverse order, so that calls
to writeAll
can be chained by passing in the previous result to used
.
Initiate a write.
Initiate a write. If a is successfully written (in its entirety) to
buffer
, then None
is returned. Otherwise, Some(s)
is returned,
indicating that some more data (ie. s
) still needs to be written using
writeMore(s, _)
. This last condition will normally happen when we run
out of space in the buffer, so a
was only partially written.
Writes the remaining data from a call to writeInit
to buffer
.
Performs an *unsafe* write of a
to buffer
.