--
You received this message because you are subscribed to the Google Groups "Chronicle" group.
To unsubscribe from this group and stop receiving emails from it, send an email to java-chronicl...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
ByteBuffer get method will get length from 0 to length you take byte array (here say 1024), and your limit is less than 1024, it will throw BufferUnderflowException.
public ByteBuffer get(byte[] dst, int offset, int length)
This method transfers bytes from this buffer into the given destination array. If there are fewer bytes remaining in the buffer than are required to satisfy the request, that is, if length > remaining(), then no bytes are transferred and a BufferUnderflowException is thrown.
Otherwise, this method copies length bytes from this buffer into the given array, starting at the current position of this buffer and at the given offset in the array. The position of this buffer is then incremented by length.
In other words, an invocation of this method of the form src.get(dst, off, len) has exactly the same effect as the loop
for (int i = off; i < off + len; i++)
dst[i] = src.get(); except that it first checks that there are sufficient bytes in this buffer and it is potentially much more efficient.dst - The array into which bytes are to be writtenoffset - The offset within the array of the first byte to be written; must be non-negative and no larger than dst.lengthlength - The maximum number of bytes to be written to the given array; must be non-negative and no larger than dst.length - offsetBufferUnderflowException - If there are fewer than length bytes remaining in this bufferIndexOutOfBoundsException - If the preconditions on the offset and length parameters do not holdThank you for letting me know you are looking at that. If you want to use byte[] instead of ByteBuffer I suggest you use byte [] as this will be more efficent than using an intermediate ByteBuffer.
Regards, Peter.
--