public static byte[] getBytes(final ByteBuffer byteBuffer) {
        final ByteBuffer dupBuffer = byteBuffer.duplicate();
        byte[] result = new byte[dupBuffer.remaining()];
        dupBuffer.get(result);
        return result;
    }
Get the requested length number of bytes from the specified index.
stroom-bytebuffer/src/main/java/stroom/bytebuffer/ByteBufferUtils.java