protected void encryptFinal() throws IOException {
  inBuffer.flip();
  outBuffer.clear();
  try {
    cipher.doFinal(inBuffer,outBuffer);
  }
 catch (  ShortBufferException e) {
    throw new IOException(e);
  }
catch (  IllegalBlockSizeException e) {
    throw new IOException(e);
  }
catch (  BadPaddingException e) {
    throw new IOException(e);
  }
  inBuffer.clear();
  outBuffer.flip();
  while (outBuffer.hasRemaining()) {
    output.write(outBuffer);
  }
}

protected void encryptFinal ( ) throws IOException { inBuffer . flip ( ) ; outBuffer . clear ( ) ; try { cipher . doFinal ( inBuffer , outBuffer ) ; } catch ( ShortBufferException e ) { throw new IOException ( e ) ; } catch ( IllegalBlockSizeException e ) { throw new IOException ( e ) ; } catch ( BadPaddingException e ) { throw new IOException ( e ) ; } inBuffer . clear ( ) ; outBuffer . flip ( ) ; while ( outBuffer . hasRemaining ( ) ) { output . write ( outBuffer ) ; } }
does final encryption of the last data .
