Skip to content

Instantly share code, notes, and snippets.

@vrunoa
Last active June 18, 2016 00:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vrunoa/b6e6b4badc8d280de7d79f5b22a7e66a to your computer and use it in GitHub Desktop.
Save vrunoa/b6e6b4badc8d280de7d79f5b22a7e66a to your computer and use it in GitHub Desktop.
chunkBuffer.java
public byte[] chunk(ByteBuffer buffer) {
byte[] finalBuffer = new byte[buffer.limit()-buffer.remaining()];
ByteBuffer target = ByteBuffer.wrap(finalBuffer);
target.order(ByteOrder.LITTLE_ENDIAN);
target.put(buffer.array(), 0, buffer.position());
retur finalBuffer
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment