/** * @return a {@link ByteBuffer} with the content of this {@link DataInfo} * @param consume whether to consume the content */ public ByteBuffer asByteBuffer(boolean consume) { ByteBuffer buffer = allocate(available()); if (consume) consumeInto(buffer); else readInto(buffer); buffer.flip(); return buffer; }