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

Variable Index

 o ident

Constructor Index

 o CipherOutputStream(OutputStream, Cipher)
Construct an SecureOutputStream.

Method Index

 o close()
Closes this output stream and releases any system resources associated with this stream.
 o flush()
Flushes this output stream and forces any processed buffered output bytes to be written out.
 o write(byte[])
Writes b.length bytes from the specified byte array to this output stream.
 o write(byte[], int, int)
Encrypt an array of bytes and write it to the stream.
 o write(int)
Encrypt a byte and write it to the stream.

Variables

 o ident
  public final static String ident

Constructors

 o CipherOutputStream
  public CipherOutputStream(OutputStream out,
                            Cipher cipher)
Construct an SecureOutputStream.
Parameters:
out - The output stream to encrypt.
encryptor - The encrypting object.

Methods

 o 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
 o 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
 o 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
 o 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
 o 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