public void addData(byte[] buf,int off,int len){
  if ((skipped + available + len) > databuf.length) {
    int desiredSize=ByteQueue.nextTwoPow(available + len);
    if (desiredSize > databuf.length) {
      byte[] tmp=new byte[desiredSize];
      System.arraycopy(databuf,skipped,tmp,0,available);
      databuf=tmp;
    }
 else {
      System.arraycopy(databuf,skipped,databuf,0,available);
    }
    skipped=0;
  }
  System.arraycopy(buf,off,databuf,skipped + available,len);
  available+=len;
}

public void addData ( byte [ ] buf , int off , int len ) { if ( ( skipped + available + len ) > databuf . length ) { int desiredSize = ByteQueue . nextTwoPow ( available + len ) ; if ( desiredSize > databuf . length ) { byte [ ] tmp = new byte [ desiredSize ] ; System . arraycopy ( databuf , skipped , tmp , 0 , available ) ; databuf = tmp ; } else { System . arraycopy ( databuf , skipped , databuf , 0 , available ) ; } skipped = 0 ; } System . arraycopy ( buf , off , databuf , skipped + available , len ) ; available += len ; }
add some data to our buffer .
