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 newOutputthat appends bytes to a growable array.static Output<byte[]>byteArrayOutput(byte[] array) static Output<byte[]>byteArrayOutput(int initialCapacity) Returns a newOutputthat appends bytes to a growable array, pre-allocated with space forinitialCapacitybytes.static Output<byte[]>byteArrayOutput(int initialCapacity, OutputSettings settings) Returns a newOutputthat appends bytes to a growable array, pre-allocated with space forinitialCapacitybytes, using the givensettings.static Output<byte[]>byteArrayOutput(OutputSettings settings) Returns a newOutputthat 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 newOutputthat appends bytes to a growable array.static Output<ByteBuffer>byteBufferOutput(byte[] array) static Output<ByteBuffer>byteBufferOutput(int initialCapacity) Returns a newOutputthat appends bytes to a growable array, pre-allocated with space forinitialCapacitybytes.static Output<ByteBuffer>byteBufferOutput(int initialCapacity, OutputSettings settings) Returns a newOutputthat appends bytes to a growable array, pre-allocated with space forinitialCapacitybytes, using the givensettings.static Output<ByteBuffer>byteBufferOutput(OutputSettings settings) Returns a newOutputthat 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 InputBufferinput(byte... bytes) static InputBufferinputBuffer(byte[] array) static InputBufferinputBuffer(byte[] array, int offset, int length) static InputBufferinputBuffer(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 newParserthat 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 theinputbuffer to the givenoutput, returning aParsercontinuation that knows how to decode subsequent input buffers.static <O> Oread(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 newOutputthat appends bytes to a growable array, pre-allocated with space forinitialCapacitybytes, using the givensettings. The returnedOutputaccepts an unbounded number of bytes, remaining permanently in the cont state, and canbindabyte[]array with the current output state at any time. -
byteArrayOutput
Returns a newOutputthat appends bytes to a growable array, pre-allocated with space forinitialCapacitybytes. The returnedOutputaccepts an unbounded number of bytes, remaining permanently in the cont state, and canbindabyte[]array with the current output state at any time. -
byteArrayOutput
Returns a newOutputthat appends bytes to a growable array, using the givensettings. The returnedOutputaccepts an unbounded number of bytes, remaining permanently in the cont state, and canbindabyte[]array with the current output state at any time. -
byteArrayOutput
-
byteArrayOutput
Returns a newOutputthat appends bytes to a growable array. The returnedOutputaccepts an unbounded number of bytes, remaining permanently in the cont state, and canbindabyte[]array with the current output state at any time. -
byteBufferOutput
Returns a newOutputthat appends bytes to a growable array, pre-allocated with space forinitialCapacitybytes, using the givensettings. The returnedOutputaccepts an unbounded number of bytes, remaining permanently in the cont state, and canbindaByteBufferwith the current output state at any time. -
byteBufferOutput
Returns a newOutputthat appends bytes to a growable array, pre-allocated with space forinitialCapacitybytes. The returnedOutputaccepts an unbounded number of bytes, remaining permanently in the cont state, and canbindaByteBufferwith the current output state at any time. -
byteBufferOutput
Returns a newOutputthat appends bytes to a growable array, using the givensettings. The returnedOutputaccepts an unbounded number of bytes, remaining permanently in the cont state, and canbindaByteBufferwith the current output state at any time. -
byteBufferOutput
-
byteBufferOutput
Returns a newOutputthat appends bytes to a growable array. The returnedOutputaccepts an unbounded number of bytes, remaining permanently in the cont state, and canbindaByteBufferwith the current output state at any time. -
outputParser
Returns a newParserthat writes decoded bytes to the givenoutput. -
parseOutput
Writes the decoded bytes of theinputbuffer to the givenoutput, returning aParsercontinuation 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
-