javax.crypto
public class CipherOutputStream extends FilterOutputStream
Constructor Summary | |
---|---|
CipherOutputStream(OutputStream out, Cipher cipher)
Create a new cipher output stream. | |
protected | CipherOutputStream(OutputStream out)
Create a cipher output stream with no cipher.
|
Method Summary | |
---|---|
void | close()
Close this output stream, and the sink output stream.
|
void | flush()
Flush any pending output.
|
void | write(int b)
Write a single byte to the output stream.
|
void | write(byte[] buf)
Write a byte array to the output stream.
|
void | write(byte[] buf, int off, int len)
Write a portion of a byte array to the output stream.
|
Parameters: out The sink for transformed data. cipher The cipher to transform data with.
Parameters: out The sink for transformed data.
This method will first invoke the {@link Cipher#doFinal()} method of the underlying {@link Cipher}, and writes the output of that method to the sink output stream.
Throws: IOException If an I/O error occurs, or if an error is caused by finalizing the transformation.
Throws: IOException If an I/O error occurs.
Parameters: b The next byte.
Throws: IOException If an I/O error occurs, or if the underlying cipher is not in the correct state to transform data.
Parameters: buf The next bytes.
Throws: IOException If an I/O error occurs, or if the underlying cipher is not in the correct state to transform data.
Parameters: buf The next bytes. off The offset in the byte array to start. len The number of bytes to write.
Throws: IOException If an I/O error occurs, or if the underlying cipher is not in the correct state to transform data.