|
It is sometimes useful to provide a shortcut for this operation:
buf.clear();
buf.fillAndReset( buf.remaining() );
I suggest to add ByteBuffer.sweep() and ByteBuffer.sweep( byte value ) so users can sweep the old content of the newly allocated buffer if they need to do:
ByteBuffer buf = ByteBuffer.allocate( 16 ).sweep();
|