class ByteBufferExtensions extends Object
Instance method extensions to the ByteBuffer class.
| Constructor and description |
|---|
ByteBufferExtensions() |
| Type Params | Return Type | Name and description |
|---|---|---|
|
static ByteBuffer |
advance(ByteBuffer self, int n)Advance the internal position of a buffer by the given amount. |
|
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. |
<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. |
Advance the internal position of a buffer by the given amount. Negative values may be given to move the position backwards.
An alias for ByteBuffer.get so that its shortened Groovy getter form looks consistent alongside the other shortened getters like short, int, etc. @return
Convenience method for calling ByteBuffer.mark, executing the closure, and then calling ByteBuffer.reset before returning. @return
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.
@return
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. @return