class ByteBufferExtensions extends Object
Instance method extensions to the ByteBuffer class.
| Constructor and description |
|---|
ByteBufferExtensions() |
| Type Params | Return Type | Name and description |
|---|---|---|
|
static byte |
getByte(ByteBuffer self)An alias for ByteBuffer.get so that its shortened Groovy getter form looks consistent alongside the other shortened getters like short, int, etc. |
|
static int |
getUnsignedByte(ByteBuffer self)Shorthand for ByteBuffer.get() & 0xff, ensuring that a byte value
when made an int remains unsigned. |
|
static int |
getUnsignedByte(ByteBuffer self, int index)Shorthand for ByteBuffer.get(index) & 0xff, ensuring that a byte
value when made an int remains unsigned. |
|
static int |
getUnsignedShort(ByteBuffer self)Shorthand for ByteBuffer.getShort() & 0xffff, ensuring that a short
value when made an int remains unsigned. |
|
static int |
getUnsignedShort(ByteBuffer self, int index)Shorthand for ByteBuffer.getShort(index) & 0xffff, ensuring that a
short value when made an int remains unsigned. |
<T> |
static T |
markAndReset(ByteBuffer self, Closure<T> closure)Convenience method for calling ByteBuffer.mark, executing the closure, and then calling ByteBuffer.reset before returning. |
|
static ByteBuffer |
put(ByteBuffer self, ByteBuffer src, int length)A relative bulk put method using another ByteBuffer but only
reading up to length bytes from that buffer. |
|
static ByteBuffer[] |
split(ByteBuffer self, int length)Split a buffer into several smaller buffers of the specified size. |
An alias for ByteBuffer.get so that its shortened Groovy getter form looks consistent alongside the other shortened getters like short, int, etc.
Shorthand for ByteBuffer.get() & 0xff, ensuring that a byte value
when made an int remains unsigned.
Shorthand for ByteBuffer.get(index) & 0xff, ensuring that a byte
value when made an int remains unsigned.
Shorthand for ByteBuffer.getShort() & 0xffff, ensuring that a short
value when made an int remains unsigned.
Shorthand for ByteBuffer.getShort(index) & 0xffff, ensuring that a
short value when made an int remains unsigned.
Convenience method for calling ByteBuffer.mark, executing the closure, and then calling ByteBuffer.reset before returning.
A relative bulk put method using another ByteBuffer but only
reading up to length bytes from that buffer. The position of both
buffers will be increased by length.
Split a buffer into several smaller buffers of the specified size. If the size doesn't cleanly divide into the current buffer, then the final buffer will be smaller and contain the remaining bytes.