Package-level declarations
Types
A builder that provides ability to build byte packets with no knowledge of it's size. Unlike Java's ByteArrayOutputStream it doesn't copy the whole content every time it's internal buffer overflows but chunks buffers instead. Packet building via build function is O(1) operation and only does instantiate a new ByteReadPacket. Once a byte packet has been built via build function call, the builder could be reused again. You also can discard all written bytes via reset or release. Please note that an instance of builder need to be terminated either via build function invocation or via release call otherwise it will cause byte buffer leak so that may have performance impact.
Usually shouldn't be implemented directly. Inherit Input instead.
This shouldn't be implemented directly. Inherit Output instead.
Functions
Build a byte packet in block lambda. Creates a temporary builder and releases it in case of failure
Copy all bytes to the output. Depending on actual input and output implementation it could be zero-copy or copy byte per byte. All regular types such as ByteReadPacket, BytePacketBuilder, Input and Output are always optimized so no bytes will be copied.
Discard exactly n bytes or fail if not enough bytes in the input to be discarded.
Discards bytes until delimiter occurred
Discards bytes until of of the specified delimiters delimiter1 or delimiter2 occurred
Creates a temporary packet view of the packet being build without discarding any bytes from the builder. This is similar to build().copy()
except that the builder keeps already written bytes untouched. A temporary view packet is passed as argument to block function and it shouldn't leak outside of this block otherwise an unexpected behaviour may occur.
Read available for read bytes to the destination array range starting at array offset and length bytes. If less than length bytes available then less bytes will be copied and the corresponding number will be returned as result.
Read available for read bytes to the destination array range starting at array offset and length elements. If less than length elements available then less elements will be copied and the corresponding number will be returned as result (possibly zero).
Read at most dst.remaining()
bytes to the specified dst byte buffer and change its position accordingly
Read exactly n (optional, read all remaining by default) bytes to a newly allocated byte buffer
Reads all remaining bytes from the input
Read the specified number of bytes specified (optional, read all remaining by default)
Read exactly n bytes (consumes all remaining if n is not specified but up to Int.MAX_VALUE bytes). Does fail if not enough bytes remaining.
Reads exactly n bytes from the input or fails if not enough bytes available.
Apply block function on a ByteBuffer of readable bytes. The block function should return number of consumed bytes.
Read a floating point number or fail if not enough bytes available for reading. The numeric value is decoded in the network order (Big Endian).
Read from this buffer to the destination array to offset and length bytes.
Read from this buffer to the destination array to offset and length bytes. Numeric values are interpreted in the network byte order (Big Endian).
Read buffer's content to the destination buffer moving its position.
Read exactly dst.remaining()
bytes to the specified dst byte buffer and change its position accordingly
Reads at most max characters decoding bytes with specified charset. Extra character bytes will remain unconsumed
Reads at most max characters decoding bytes with specified decoder. Extra character bytes will remain unconsumed
Read exactly the specified number of bytes interpreting bytes in the specified charset (optional, UTF-8 by default).
Read exactly bytesCount interpreting bytes in the specified charset (optional, UTF-8 by default).
Read exactly charactersCount characters interpreting bytes in the specified charset.
Read an unsigned long integer or fail if not enough bytes available for reading. The numeric value is decoded in the network order (Big Endian).
Copies to dst output until one of the specified delimiters delimiter1 or delimiter2 occurred.
Copies to dst array at offset at most length bytes or until one of the specified delimiters delimiter1 or delimiter2 occurred.
Read an unsigned short integer or fail if not enough bytes available for reading. The numeric value is decoded in the network order (Big Endian).
Reads UTF-8 line and append all line characters to out except line endings. Supports CR, LF and CR+LF
Reads UTF-8 characters until one of the specified delimiters found, limit exceeded or end of stream encountered
Reads UTF-8 characters to out buffer until one of the specified delimiters found, limit exceeded or end of stream encountered
Discard all written bytes and prepare to build another packet.
Write bytes directly to packet builder's segment. Generally shouldn't be used in user's code and useful for efficient integration.
Write bytes directly to packet builder's segment. Generally shouldn't be used in user's code and useful for efficient integration.
Apply block function on a ByteBuffer of the free space. The block function should return number of written bytes.
Write a floating point number or fail if not enough space available for writing. The numeric value is encoded in the network order (Big Endian).
Write a floating point number or fail if not enough space available for writing. The numeric value is encoded in the network order (Big Endian).
Write all readable bytes from src to this buffer. Fails if not enough space available to write all bytes.
Write at most length readable bytes from src to this buffer. Fails if not enough space available to write all bytes.
Write source buffer content moving its position.
Write all remaining src buffer bytes and change its position accordingly
Write a long integer or fail if not enough space available for writing. The numeric value is encoded in the network order (Big Endian).
Write a short integer or fail if not enough space available for writing. The numeric value is encoded in the network order (Big Endian).
Write an unsigned byte or fail if not enough space available for writing.
Write an unsigned integer or fail if not enough space available for writing. The numeric value is encoded in the network order (Big Endian).
Write an unsigned long integer or fail if not enough space available for writing. The numeric value is encoded in the network order (Big Endian).
Write an unsigned short integer or fail if not enough space available for writing. The numeric value is encoded in the network order (Big Endian).
Properties
For streaming input it should be Input.endOfInput instead.
For streaming input there is no reliable way to detect it without triggering bytes population from the underlying source. Consider using Input.endOfInput or use ByteReadPacket instead.