public void ensureAdditionalCapacity(final int size){
  final int newCount=visible.position() + size;
  if (newCount > visible.capacity()) {
    final ByteBuffer newByteBuffer=ByteBuffer.allocate(Math.max(visible.capacity() << 1,newCount));
    visible.flip();
    visible=newByteBuffer.put(visible);
  }
}

public void ensureAdditionalCapacity ( final int size ) { final int newCount = visible . position ( ) + size ; if ( newCount > visible . capacity ( ) ) { final ByteBuffer newByteBuffer = ByteBuffer . allocate ( Math . max ( visible . capacity ( ) << 1 , newCount ) ) ; visible . flip ( ) ; visible = newByteBuffer . put ( visible ) ; } }
ensures that the specified number of additional bytes will fit in the buffer and resizes it if necessary .
