ByteReadPacket
Constructors
Types
Functions
Returns a copy of the packet. The original packet and the copy could be used concurrently. Both need to be either completely consumed or released via release
Discards exactly n bytes or fails with EOFException
Try to copy at least min but up to max bytes to the specified destination buffer from this input skipping offset bytes. If there are not enough bytes available to provide min bytes after skipping offset bytes then it will trigger the underlying source reading first and after that will simply copy available bytes even if EOF encountered so min is not a requirement but a desired number of bytes. It is safe to specify max greater than the destination free space. min
shouldn't be bigger than the destination free space. This function could trigger the underlying source reading that may lead to blocking I/O. It is allowed to specify too big offset so in this case this function will always return 0
after prefetching all underlying bytes but note that it may lead to significant memory consumption. This function usually copy more bytes than min (unless max = min
) but it is not guaranteed. When 0
is returned with offset = 0
then it makes sense to check endOfInput.
Read a string exactly exactCharacters length
Read exactly exactCharacters characters and append them to out
Release packet. After this function invocation the packet becomes empty. If it has been copied via ByteReadPacket.copy then the copy should be released as well.
Properties
Extensions
Creates InputStream adapter to the packet
Read exactly n bytes to a new array buffer instance
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
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.
Creates Reader from the byte packet that decodes UTF-8 characters
Read exactly dst.remaining()
bytes to the specified dst byte buffer and change its position accordingly