java.lang.Object | |||
↳ | java.io.OutputStream | ||
↳ | java.io.FilterOutputStream | ||
↳ | javax.crypto.CipherOutputStream |
This class wraps an output stream and a cipher so that write
methods
send the data through the cipher before writing them to the underlying output
stream.
The cipher must be initialized for the requested operation before being used
by a CipherOutputStream
. For example, if a cipher initialized for
encryption is used with a CipherOutputStream
, the CipherOutputStream
tries to encrypt the data writing it out.
[Expand]
Inherited Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.io.FilterOutputStream
|
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Creates a new
CipherOutputStream instance for an OutputStream and a Cipher . |
Protected Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Creates a new
CipherOutputStream instance for an OutputStream without a cipher. |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Close this cipher output stream.
| |||||||||||
Flushes this cipher output stream.
| |||||||||||
Writes the buffer of bytes to this cipher output stream.
| |||||||||||
Writes the single byte to this cipher output stream.
| |||||||||||
Writes the
len bytes from buffer b starting at offset
off to this cipher output stream. |
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class java.io.FilterOutputStream
| |||||||||||
From class java.io.OutputStream
| |||||||||||
From class java.lang.Object
| |||||||||||
From interface java.io.Closeable
| |||||||||||
From interface java.io.Flushable
|
Creates a new CipherOutputStream
instance for an OutputStream
and a Cipher
.
os | the output stream to write data to. |
---|---|
c | the cipher to process the data with. |
Creates a new CipherOutputStream
instance for an OutputStream
without a cipher.
A NullCipher
is created to process the data.
os | the output stream to write the data to. |
---|
Close this cipher output stream.
On the underlying cipher doFinal
will be invoked, and any
buffered bytes from the cipher are also written out, and the cipher is
reset to its initial state. The underlying output stream is also closed.
IOException | if an error occurs. |
---|
Flushes this cipher output stream.
IOException | if an error occurs |
---|
Writes the buffer of bytes to this cipher output stream.
b | the buffer of bytes. |
---|
IOException | if an error occurs. |
---|
Writes the single byte to this cipher output stream.
b | the byte to write. |
---|
IOException | if an error occurs. |
---|
Writes the len
bytes from buffer b
starting at offset
off
to this cipher output stream.
b | the buffer. |
---|---|
off | the offset to start at. |
len | the number of bytes. |
IOException | if an error occurs. |
---|