public void appendData(ParsableByteArray buffer,int length){
  int remainingWriteLength=length;
  while (remainingWriteLength > 0) {
    if (dataQueue.isEmpty() || lastFragmentOffset == fragmentLength) {
      lastFragmentOffset=0;
      lastFragment=fragmentPool.allocateDirect();
      dataQueue.add(lastFragment);
    }
    int thisWriteLength=Math.min(remainingWriteLength,fragmentLength - lastFragmentOffset);
    buffer.readBytes(lastFragment,lastFragmentOffset,thisWriteLength);
    lastFragmentOffset+=thisWriteLength;
    remainingWriteLength-=thisWriteLength;
  }
  totalBytesWritten+=length;
}

public void appendData ( ParsableByteArray buffer , int length ) { int remainingWriteLength = length ; while ( remainingWriteLength > 0 ) { if ( dataQueue . isEmpty ( ) || lastFragmentOffset == fragmentLength ) { lastFragmentOffset = 0 ; lastFragment = fragmentPool . allocateDirect ( ) ; dataQueue . add ( lastFragment ) ; } int thisWriteLength = Math . min ( remainingWriteLength , fragmentLength - lastFragmentOffset ) ; buffer . readBytes ( lastFragment , lastFragmentOffset , thisWriteLength ) ; lastFragmentOffset += thisWriteLength ; remainingWriteLength -= thisWriteLength ; } totalBytesWritten += length ; }
appends data to the rolling buffer .
