Class javax.crypto.CipherOutputStream
All Packages Class Hierarchy This Package Previous Next Index
Class javax.crypto.CipherOutputStream
java.lang.Object
|
+----java.io.OutputStream
|
+----java.io.FilterOutputStream
|
+----javax.crypto.CipherOutputStream
- public class CipherOutputStream
- extends FilterOutputStream
A stream filter that encrypts bytes as they are written.
- See Also:
- StreamEncryptor
-
ident
-
-
CipherOutputStream(OutputStream, Cipher)
- Construct an SecureOutputStream.
-
close()
- Closes this output stream and releases any system resources
associated with this stream.
-
flush()
- Flushes this output stream and forces any processed buffered
output bytes to be written out.
-
write(byte[])
- Writes b.length bytes from the specified byte array to this output
stream.
-
write(byte[], int, int)
- Encrypt an array of bytes and write it to the stream.
-
write(int)
- Encrypt a byte and write it to the stream.
ident
public final static String ident
CipherOutputStream
public CipherOutputStream(OutputStream out,
Cipher cipher)
- Construct an SecureOutputStream.
- Parameters:
- out - The output stream to encrypt.
- encryptor - The encrypting object.
write
public void write(int b) throws IOException
- Encrypt a byte and write it to the stream.
- Parameters:
- b - The byte to write.
- Throws: IOException
- If the byte cannot be encrypted
or written.
- Overrides:
- write in class FilterOutputStream
write
public void write(byte b[]) throws IOException
- Writes 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.
- Parameters:
- b - the data.
- Throws: IOException
- if an I/O error occurs.
- Overrides:
- write in class FilterOutputStream
- See Also:
- write
write
public void write(byte b[],
int off,
int len) throws IOException
- Encrypt an array of bytes and write it to the stream.
- Parameters:
- b - The bytes to be written.
- off - The index of the first byte to write.
- len - The number of bytes to write.
- Throws: IOException
- If the byte cannot be encrypted
or written.
- Overrides:
- write in class FilterOutputStream
flush
public void flush() throws IOException
- Flushes this output stream and forces any processed buffered
output bytes to be written out.
- Throws: IOException
- if an I/O error occurs
- Overrides:
- flush in class FilterOutputStream
close
public void close() throws IOException
- Closes this output stream and releases any system resources
associated with this stream.
The close method of CipherOutputStream calls its flush method,
and then calls the close method of its underlying output stream.
- Throws: IOException
- if an I/O error occurs
- Overrides:
- close in class FilterOutputStream
All Packages Class Hierarchy This Package Previous Next Index