public ByteBuffer rewind() { buf.rewind(); return this; }
private static ByteBuffer createBuffer(final ByteBuffer buffer) { final ByteBuffer data = ByteBuffer.allocate( buffer.limit() - buffer.position()); LOG.trace("Created buffer with capacity: "+data.capacity()); data.put(buffer); data.rewind(); return data; }