Compares the two specified buffers as described in {@link ByteBuf#compareTo(ByteBuf)}. This method is useful when implementing a new buffer type.
Encode the given {@link CharBuffer} using the given {@link Charset} into a new {@link ByteBuf} which is allocated via the {@link ByteBufAllocator}.
Used to determine if the return value of {@link ByteBuf#ensureWritable(int, bool)} means that there is adequate space and a write operation will succeed. @param ensureWritableResult The return value from {@link ByteBuf#ensureWritable(int, bool)}. @return {@code true} if {@code ensureWritableResult} means that there is adequate space and a write operation will succeed.
Returns {@code true} if and only if the two specified buffers are identical to each other for {@code length} bytes starting at {@code aStartIndex} index for the {@code a} buffer and {@code bStartIndex} index for the {@code b} buffer. A more compact way to express this is: <p> {@code a[aStartIndex : aStartIndex + length] == b[bStartIndex : bStartIndex + length]}
Returns {@code true} if and only if the two specified buffers are identical to each other as described in {@link ByteBuf#equals(Object)}. This method is useful when implementing a new buffer type.
Create a copy of the underlying storage from {@code buf} into a byte array. The copy will start at {@link ByteBuf#readerIndex()} and copy {@link ByteBuf#readableBytes()} bytes.
Create a copy of the underlying storage from {@code buf} into a byte array. The copy will start at {@code start} and copy {@code length} bytes.
Return an array of the underlying storage from {@code buf} into a byte array. The copy will start at {@code start} and copy {@code length} bytes. If {@code copy} is true a copy will be made of the memory. If {@code copy} is false the underlying storage will be shared, if possible.
Returns a <a href="http://en.wikipedia.org/wiki/Hex_dump">hex dump</a> of the specified buffer's readable bytes.
Returns a <a href="http://en.wikipedia.org/wiki/Hex_dump">hex dump</a> of the specified buffer's sub-region.
Returns a <a href="http://en.wikipedia.org/wiki/Hex_dump">hex dump</a> of the specified byte array.
Returns a <a href="http://en.wikipedia.org/wiki/Hex_dump">hex dump</a> of the specified byte array's sub-region.
Returns the reader index of needle in haystack, or -1 if needle is not in haystack.
The default implementation of {@link ByteBuf#indexOf(int, int, byte)}. This method is useful when implementing a new buffer type.
Read the given amount of bytes into a new {@link ByteBuf} that is allocated from the {@link ByteBufAllocator}.
Toggles the endianness of the specified 32-bit integer.
Toggles the endianness of the specified 64-bit long integer.
Toggles the endianness of the specified 24-bit medium integer.
Toggles the endianness of the specified 16-bit short integer.
Allocates a new array if minLength > {@link ByteBufUtil#MAX_TL_ARRAY_LEN}
Calculates the hash code of the specified buffer. This method is useful when implementing a new buffer type.
A collection of utility methods that is related with handling {@link ByteBuf}, such as the generation of hex dump and swapping an integer's byte order.