private void ensureCapacity(int additionalData){
  if ((this.position + additionalData) > this.byteBuffer.length) {
    int newLength=(int)(this.byteBuffer.length * 1.25);
    if (newLength < (this.byteBuffer.length + additionalData)) {
      newLength=this.byteBuffer.length + (int)(additionalData * 1.25);
    }
    if (newLength < this.byteBuffer.length) {
      newLength=this.byteBuffer.length + additionalData;
    }
    byte[] newBytes=new byte[newLength];
    System.arraycopy(this.byteBuffer,0,newBytes,0,this.byteBuffer.length);
    this.byteBuffer=newBytes;
  }
}

private void ensureCapacity ( int additionalData ) { if ( ( this . position + additionalData ) > this . byteBuffer . length ) { int newLength = ( int ) ( this . byteBuffer . length * 1.25 ) ; if ( newLength < ( this . byteBuffer . length + additionalData ) ) { newLength = this . byteBuffer . length + ( int ) ( additionalData * 1.25 ) ; } if ( newLength < this . byteBuffer . length ) { newLength = this . byteBuffer . length + additionalData ; } byte [ ] newBytes = new byte [ newLength ] ; System . arraycopy ( this . byteBuffer , 0 , newBytes , 0 , this . byteBuffer . length ) ; this . byteBuffer = newBytes ; } }
ensure that there are additionaldata bytes available in the buffer . if not realocate the buffer .
