/** * Returns a copy of a sub-sequence the Buffer as a {@code byte[]} starting at position {@code * start} and ending at position {@code end - 1} */ public byte[] getBytes(int start, int end) { byte[] arr = new byte[end - start]; buffer.getBytes(start, arr, 0, end - start); return arr; }
/** Returns a copy of the entire Buffer as a {@code byte[]} */ public byte[] getBytes() { byte[] arr = new byte[buffer.writerIndex()]; buffer.getBytes(0, arr); return arr; }