public int processBytes(byte[] in,int inOff,int len,byte[] out,int outOff) throws DataLengthException, IllegalStateException {
  if (len < 0) {
    throw new IllegalArgumentException("Can't have a negative input length!");
  }
  int blockSize=getBlockSize();
  int length=getUpdateOutputSize(len);
  if (length > 0) {
    if ((outOff + length) > out.length) {
      throw new DataLengthException("output buffer too short");
    }
  }
  int resultLen=0;
  int gapLen=buf.length - bufOff;
  if (len > gapLen) {
    System.arraycopy(in,inOff,buf,bufOff,gapLen);
    resultLen+=cipher.processBlock(buf,0,out,outOff);
    System.arraycopy(buf,blockSize,buf,0,blockSize);
    bufOff=blockSize;
    len-=gapLen;
    inOff+=gapLen;
    while (len > blockSize) {
      System.arraycopy(in,inOff,buf,bufOff,blockSize);
      resultLen+=cipher.processBlock(buf,0,out,outOff + resultLen);
      System.arraycopy(buf,blockSize,buf,0,blockSize);
      len-=blockSize;
      inOff+=blockSize;
    }
  }
  System.arraycopy(in,inOff,buf,bufOff,len);
  bufOff+=len;
  return resultLen;
}

public int processBytes ( byte [ ] in , int inOff , int len , byte [ ] out , int outOff ) throws DataLengthException , IllegalStateException { if ( len < 0 ) { throw new IllegalArgumentException ( "Can't have a negative input length!" ) ; } int blockSize = getBlockSize ( ) ; int length = getUpdateOutputSize ( len ) ; if ( length > 0 ) { if ( ( outOff + length ) > out . length ) { throw new DataLengthException ( "output buffer too short" ) ; } } int resultLen = 0 ; int gapLen = buf . length - bufOff ; if ( len > gapLen ) { System . arraycopy ( in , inOff , buf , bufOff , gapLen ) ; resultLen += cipher . processBlock ( buf , 0 , out , outOff ) ; System . arraycopy ( buf , blockSize , buf , 0 , blockSize ) ; bufOff = blockSize ; len -= gapLen ; inOff += gapLen ; while ( len > blockSize ) { System . arraycopy ( in , inOff , buf , bufOff , blockSize ) ; resultLen += cipher . processBlock ( buf , 0 , out , outOff + resultLen ) ; System . arraycopy ( buf , blockSize , buf , 0 , blockSize ) ; len -= blockSize ; inOff += blockSize ; } } System . arraycopy ( in , inOff , buf , bufOff , len ) ; bufOff += len ; return resultLen ; }
process an array of bytes , producing output if necessary .
