public byte[] toByteArray(){
  int totalLen=_pastLen + _currBlockPtr;
  if (totalLen == 0) {
    return NO_BYTES;
  }
  byte[] result=new byte[totalLen];
  int offset=0;
  for (  byte[] block : _pastBlocks) {
    int len=block.length;
    System.arraycopy(block,0,result,offset,len);
    offset+=len;
  }
  System.arraycopy(_currBlock,0,result,offset,_currBlockPtr);
  offset+=_currBlockPtr;
  if (offset != totalLen) {
    throw new RuntimeException("Internal error: total len assumed to be " + totalLen + ", copied "+ offset+ " bytes");
  }
  if (!_pastBlocks.isEmpty()) {
    reset();
  }
  return result;
}

public byte [ ] toByteArray ( ) { int totalLen = _pastLen + _currBlockPtr ; if ( totalLen == 0 ) { return NO_BYTES ; } byte [ ] result = new byte [ totalLen ] ; int offset = 0 ; for ( byte [ ] block : _pastBlocks ) { int len = block . length ; System . arraycopy ( block , 0 , result , offset , len ) ; offset += len ; } System . arraycopy ( _currBlock , 0 , result , offset , _currBlockPtr ) ; offset += _currBlockPtr ; if ( offset != totalLen ) { throw new RuntimeException ( "Internal error: total len assumed to be " + totalLen + ", copied " + offset + " bytes" ) ; } if ( ! _pastBlocks . isEmpty ( ) ) { reset ( ) ; } return result ; }
method called when results are finalized and we can get the full aggregated result buffer to return to the caller
