org.dmonix.cipher
Class DMCipherOutputStream

java.lang.Object
  extended byjava.io.OutputStream
      extended byjava.io.FilterOutputStream
          extended byorg.dmonix.cipher.DMCipherOutputStream
Direct Known Subclasses:
DMCipherOutputStreamDES, DMCipherOutputStreamPBE

public abstract class DMCipherOutputStream
extends java.io.FilterOutputStream

The base class for all ciphered output streams.

Copyright: Copyright (c) 2004

Company: dmonix.org

Version:
1.0
Author:
Peter Nerg

Field Summary
 
Fields inherited from class java.io.FilterOutputStream
out
 
Constructor Summary
protected DMCipherOutputStream(java.io.OutputStream ostream, java.lang.String cipherAlgorithm)
           
 
Method Summary
 java.lang.Object clone()
          THIS METHOD IS NOT SUPPORTED!
 void close()
          Closes this output stream and releases any system resources associated with the stream.
 void flush()
          Flushes this output stream and forces any buffered output bytes to be written out to the stream.
protected  void initCipher(java.security.Key key)
          Init the cipher.
protected  void initCipher(java.security.Key key, java.security.spec.AlgorithmParameterSpec param)
          Init the cipher.
 void write(byte[] b)
          Writes b.length bytes to this output stream.
 void write(byte[] b, int off, int len)
          Writes len bytes from the specified byte array starting at offset off to this output stream.
 void write(int b)
          Writes the specified byte to this output stream.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DMCipherOutputStream

protected DMCipherOutputStream(java.io.OutputStream ostream,
                               java.lang.String cipherAlgorithm)
                        throws java.security.NoSuchAlgorithmException,
                               javax.crypto.NoSuchPaddingException
Method Detail

clone

public final java.lang.Object clone()
                             throws java.lang.CloneNotSupportedException
THIS METHOD IS NOT SUPPORTED!
The method always throws java.lang.CloneNotSupportedException

Returns:
-
Throws:
java.lang.CloneNotSupportedException - The exception is always thrown

close

public void close()
           throws java.io.IOException
Closes this output stream and releases any system resources associated with the stream.
The close method of this class calls its flush method, and then calls the close method of its underlying output stream.

Throws:
java.io.IOException

flush

public void flush()
           throws java.io.IOException
Flushes this output stream and forces any buffered output bytes to be written out to the stream.

Throws:
java.io.IOException

write

public void write(byte[] b)
           throws java.io.IOException
Writes b.length bytes to this output stream.

Parameters:
b - the data to be written.
Throws:
java.io.IOException

write

public void write(byte[] b,
                  int off,
                  int len)
           throws java.io.IOException
Writes len bytes from the specified byte array starting at offset off to this output stream.

Parameters:
b - the data.
off - the start offset in the data.
len - the number of bytes to write.
Throws:
java.io.IOException

write

public void write(int b)
           throws java.io.IOException
Writes the specified byte to this output stream.

Parameters:
b - the data
Throws:
java.io.IOException

initCipher

protected void initCipher(java.security.Key key)
                   throws java.security.InvalidKeyException
Init the cipher.

Parameters:
key - The key for the cipher
Throws:
java.security.InvalidKeyException

initCipher

protected void initCipher(java.security.Key key,
                          java.security.spec.AlgorithmParameterSpec param)
                   throws java.security.InvalidKeyException,
                          java.security.InvalidAlgorithmParameterException
Init the cipher.

Parameters:
key - The key for the cipher
param - Cipher parameters
Throws:
java.security.InvalidKeyException
java.security.InvalidAlgorithmParameterException


Copyright © 1998-2005 dmonix.org Peter Nerg, All Rights Reserved.