java.lang.Object
swim.codec.Binary
Byte
Input
/Output
factory.
The Binary.byteArrayOutput(...)
family of functions return an
Output
that writes bytes to a growable array, and bind
a byte[]
array containing all written bytes.
The Binary.byteBufferOutput(...)
family of functions return an
Output
that writes bytes to a growable array, and bind
a ByteBuffer
containing all written bytes.
-
Method Summary
Modifier and TypeMethodDescriptionstatic Output<byte[]>
Returns a newOutput
that appends bytes to a growable array.static Output<byte[]>
byteArrayOutput
(byte[] array) static Output<byte[]>
byteArrayOutput
(int initialCapacity) Returns a newOutput
that appends bytes to a growable array, pre-allocated with space forinitialCapacity
bytes.static Output<byte[]>
byteArrayOutput
(int initialCapacity, OutputSettings settings) Returns a newOutput
that appends bytes to a growable array, pre-allocated with space forinitialCapacity
bytes, using the givensettings
.static Output<byte[]>
byteArrayOutput
(OutputSettings settings) Returns a newOutput
that appends bytes to a growable array, using the givensettings
.static Writer<byte[],
?> byteArrayWriter
(byte[] input) byteArrayWriter
(O value, byte[] input) byteBufferEWriter
(O value, ByteBuffer input) static Output<ByteBuffer>
Returns a newOutput
that appends bytes to a growable array.static Output<ByteBuffer>
byteBufferOutput
(byte[] array) static Output<ByteBuffer>
byteBufferOutput
(int initialCapacity) Returns a newOutput
that appends bytes to a growable array, pre-allocated with space forinitialCapacity
bytes.static Output<ByteBuffer>
byteBufferOutput
(int initialCapacity, OutputSettings settings) Returns a newOutput
that appends bytes to a growable array, pre-allocated with space forinitialCapacity
bytes, using the givensettings
.static Output<ByteBuffer>
byteBufferOutput
(OutputSettings settings) Returns a newOutput
that appends bytes to a growable array, using the givensettings
.static Writer<ByteBuffer,
Object> static Writer<Object,
ByteBuffer> byteBufferWriter
(ByteBuffer input) static <O> Decoder<O>
decode
(InputStream input, Decoder<O> decoder) static InputBuffer
input
(byte... bytes) static InputBuffer
inputBuffer
(byte[] array) static InputBuffer
inputBuffer
(byte[] array, int offset, int length) static InputBuffer
inputBuffer
(ByteBuffer buffer) static <O> Parser<O>
static OutputBuffer<ByteBuffer>
outputBuffer
(byte[] array) static OutputBuffer<ByteBuffer>
outputBuffer
(byte[] array, int offset, int length) static OutputBuffer<ByteBuffer>
outputBuffer
(ByteBuffer buffer) static <O> Parser<O>
outputParser
(Output<O> output) Returns a newParser
that writes decoded bytes to the givenoutput
.static <O> Parser<O>
static <O> Parser<O>
parseOutput
(Input input, Output<O> output) Writes the decoded bytes of theinput
buffer to the givenoutput
, returning aParser
continuation that knows how to decode subsequent input buffers.static <O> O
read
(InputStream input, Decoder<O> decoder) writeByteArray
(Output<?> output, byte[] input) writeByteBuffer
(Output<?> output, ByteBuffer input)
-
Method Details
-
input
-
inputBuffer
-
inputBuffer
-
inputBuffer
-
outputBuffer
-
outputBuffer
-
outputBuffer
-
byteArrayOutput
Returns a newOutput
that appends bytes to a growable array, pre-allocated with space forinitialCapacity
bytes, using the givensettings
. The returnedOutput
accepts an unbounded number of bytes, remaining permanently in the cont state, and canbind
abyte[]
array with the current output state at any time. -
byteArrayOutput
Returns a newOutput
that appends bytes to a growable array, pre-allocated with space forinitialCapacity
bytes. The returnedOutput
accepts an unbounded number of bytes, remaining permanently in the cont state, and canbind
abyte[]
array with the current output state at any time. -
byteArrayOutput
Returns a newOutput
that appends bytes to a growable array, using the givensettings
. The returnedOutput
accepts an unbounded number of bytes, remaining permanently in the cont state, and canbind
abyte[]
array with the current output state at any time. -
byteArrayOutput
-
byteArrayOutput
Returns a newOutput
that appends bytes to a growable array. The returnedOutput
accepts an unbounded number of bytes, remaining permanently in the cont state, and canbind
abyte[]
array with the current output state at any time. -
byteBufferOutput
Returns a newOutput
that appends bytes to a growable array, pre-allocated with space forinitialCapacity
bytes, using the givensettings
. The returnedOutput
accepts an unbounded number of bytes, remaining permanently in the cont state, and canbind
aByteBuffer
with the current output state at any time. -
byteBufferOutput
Returns a newOutput
that appends bytes to a growable array, pre-allocated with space forinitialCapacity
bytes. The returnedOutput
accepts an unbounded number of bytes, remaining permanently in the cont state, and canbind
aByteBuffer
with the current output state at any time. -
byteBufferOutput
Returns a newOutput
that appends bytes to a growable array, using the givensettings
. The returnedOutput
accepts an unbounded number of bytes, remaining permanently in the cont state, and canbind
aByteBuffer
with the current output state at any time. -
byteBufferOutput
-
byteBufferOutput
Returns a newOutput
that appends bytes to a growable array. The returnedOutput
accepts an unbounded number of bytes, remaining permanently in the cont state, and canbind
aByteBuffer
with the current output state at any time. -
outputParser
Returns a newParser
that writes decoded bytes to the givenoutput
. -
parseOutput
Writes the decoded bytes of theinput
buffer to the givenoutput
, returning aParser
continuation that knows how to decode subsequent input buffers. -
nullParser
-
parseNull
-
byteArrayWriter
-
byteArrayWriter
-
byteArrayWriter
-
byteBufferWriter
-
byteBufferWriter
-
byteBufferEWriter
-
writeByteArray
-
writeByteBuffer
-
channelEncoder
-
channelEncoder
public static Encoder<ReadableByteChannel,ReadableByteChannel> channelEncoder(ReadableByteChannel input) -
decode
- Throws:
IOException
-
read
- Throws:
IOException
-