public int doFinal(byte[] out,int outOff) throws DataLengthException, IllegalStateException, InvalidCipherTextException {
  try {
    int resultLen=0;
    if (outOff + bufOff > out.length) {
      throw new OutputLengthException("output buffer too short for doFinal()");
    }
    if (bufOff != 0) {
      if (!partialBlockOkay) {
        throw new DataLengthException("data not block size aligned");
      }
      cipher.processBlock(buf,0,buf,0);
      resultLen=bufOff;
      bufOff=0;
      System.arraycopy(buf,0,out,outOff,resultLen);
    }
    return resultLen;
  }
  finally {
    reset();
  }
}

public int doFinal ( byte [ ] out , int outOff ) throws DataLengthException , IllegalStateException , InvalidCipherTextException { try { int resultLen = 0 ; if ( outOff + bufOff > out . length ) { throw new OutputLengthException ( "output buffer too short for doFinal()" ) ; } if ( bufOff != 0 ) { if ( ! partialBlockOkay ) { throw new DataLengthException ( "data not block size aligned" ) ; } cipher . processBlock ( buf , 0 , buf , 0 ) ; resultLen = bufOff ; bufOff = 0 ; System . arraycopy ( buf , 0 , out , outOff , resultLen ) ; } return resultLen ; } finally { reset ( ) ; } }
process the last block in the buffer .
