public final int update (ByteBuffer input, ByteBuffer output) throws ShortBufferException

Continues a multiple-part encryption or decryption operation (depending on how this cipher was initialized), processing another data part.

All input.remaining() bytes starting at input.position() are processed. The result is stored in the output buffer. Upon return, the input buffer's position will be equal to its limit; its limit will not have changed. The output buffer's position will have advanced by n, where n is the value returned by this method; the output buffer's limit will not have changed.

If output.remaining() bytes are insufficient to hold the result, a ShortBufferException is thrown. In this case, repeat this call with a larger output buffer. Use getOutputSize to determine how big the output buffer should be.

Note: this method should be copy-safe, which means the input and output buffers can reference the same block of memory and no unprocessed input data is overwritten when the result is copied into the output buffer.

Parameters:
input    the input ByteBuffer
output    the output ByteByffer

Returns:  the number of bytes stored in output

Exceptions:
IllegalStateException    if this cipher is in a wrong state (e.g., has not been initialized)
IllegalArgumentException    if input and output are the same object
ReadOnlyBufferException    if the output buffer is read-only
ShortBufferException    if there is insufficient space in the output buffer

Since:  1.5