Flip the buffer to fill mode.
The position is set to the first unused position in the buffer
(the old limit) and the limit is set to the capacity.
If the buffer is empty, then this call is effectively {@link #clearToFill(ByteBuffer)}.
If there is no unused space to fill, a {@link ByteBuffer#compact()} is done to attempt
to create space.
<p>
This method is used as a replacement to {@link ByteBuffer#compact()}.
@param buffer The buffer to flip
@return The position of the valid data before the flipped position. This value should be
passed to a subsequent call to {@link #flipToFlush(ByteBuffer, int)}
Flip the buffer to fill mode. The position is set to the first unused position in the buffer (the old limit) and the limit is set to the capacity. If the buffer is empty, then this call is effectively {@link #clearToFill(ByteBuffer)}. If there is no unused space to fill, a {@link ByteBuffer#compact()} is done to attempt to create space. <p> This method is used as a replacement to {@link ByteBuffer#compact()}.
@param buffer The buffer to flip @return The position of the valid data before the flipped position. This value should be passed to a subsequent call to {@link #flipToFlush(ByteBuffer, int)}