Contents | Package | Class | Tree | Deprecated | Index | Help | |||
PREV | NEXT | SHOW LISTS | HIDE LISTS |
java.lang.Object | +----java.io.OutputStream | +----java.io.FilterOutputStream | +----javax.crypto.CipherOutputStream
For example, if the Cipher is initialized for encryption, the CipherOutputStream will attempt to encrypt data before writing out the encrypted data.
This class adheres strictly to the semantics, especially the failure semantics, of its ancestor classes java.io.OutputStream and java.io.FilterOutputStream. This class has exactly those methods specified in its ancestor classes, and overrides them all. Moreover, this class catches all exceptions that are not thrown by its ancestor classes.
It is crucial for a programmer using this class not to use methods that are not defined or overriden in this class (such as a new method or constructor that is later added to one of the super classes), because the design and implementation of those methods are unlikely to have considered security impact with regard to CipherOutputStream.
Fields inherited from class java.io.FilterOutputStream |
out |
Constructor Summary | |
CipherOutputStream(java.io.OutputStream os,
Cipher c)
|
|
CipherOutputStream(java.io.OutputStream os)
|
Method Summary | |
void | close()
|
void | flush()
|
void | write(int b)
|
void | write(byte[] b)
b.length bytes from the specified byte array
to this output stream.
|
void | write(byte[] b,
int off,
int len)
len bytes from the specified byte array
starting at offset off to this output stream.
|
Methods inherited from class java.io.FilterOutputStream |
close, flush, write, write, write |
Methods inherited from class java.io.OutputStream |
close, flush, write, write, write |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public CipherOutputStream(java.io.OutputStream os, Cipher c)
protected CipherOutputStream(java.io.OutputStream os)
Method Detail |
public void write(int b) throws java.io.IOException
b
- the byte
.
public void write(byte[] b) throws java.io.IOException
b.length
bytes from the specified byte array
to this output stream.
The write
method of
CipherOutputStream
calls the write
method of three arguments with the three arguments
b
, 0
, and b.length
.
b
- the data.
public void write(byte[] b, int off, int len) throws java.io.IOException
len
bytes from the specified byte array
starting at offset off
to this output stream.
b
- the data.
off
- the start offset in the data.
len
- the number of bytes to write.
public void flush() throws java.io.IOException
public void close() throws java.io.IOException
Any bytes buffered by the encapsulated Cipher object are processed,
and the result is written out by calling the
flush
method of CipherOutputStream
.
This method resets the encapsulated Cipher object to its initial state
and calls the close
method of the underlying output
stream.
Contents | Package | Class | Tree | Deprecated | Index | Help | |||
PREV | NEXT | SHOW LISTS | HIDE LISTS |