public void assureBufferCapacity(final int len){
  while (len > buffer.remaining()) {
    int newCapacity=Math.max((int)(len + buffer.position() * BIG_SIZE_INCREASE),(int)((buffer.capacity() > 4194304) ? buffer.capacity() * BIG_SIZE_INCREASE : buffer.capacity() * NORMAL_INCREASE));
    increase(newCapacity);
  }
}

public void assureBufferCapacity ( final int len ) { while ( len > buffer . remaining ( ) ) { int newCapacity = Math . max ( ( int ) ( len + buffer . position ( ) * BIG_SIZE_INCREASE ) , ( int ) ( ( buffer . capacity ( ) > 4194304 ) ? buffer . capacity ( ) * BIG_SIZE_INCREASE : buffer . capacity ( ) * NORMAL_INCREASE ) ) ; increase ( newCapacity ) ; } }
ensure that the buffer remaining size permit to write a data with a size len .
