CoherenceTM v3.3
Copyright© 2000-2007 by Oracle Corporation

com.tangosol.net.security
Class BlockCipherOutputStream

java.lang.Object
  extended by java.io.OutputStream
      extended by java.io.FilterOutputStream
          extended by com.tangosol.net.security.BlockCipherOutputStream
All Implemented Interfaces:
Closeable, Flushable

public class BlockCipherOutputStream
extends FilterOutputStream

InputStream which supports block ciphers, and data sizes which exceed the Cipher's block size.

Author:
mf 2006.08.08

Field Summary
protected  byte[] m_abBlockClear
          The current block of unencrypted data
protected  Cipher m_cipher
          The Encryption Cipher
protected  int m_nBlockIndex
          The next available index to write into the unencrypted data block.
 
Fields inherited from class java.io.FilterOutputStream
out
 
Constructor Summary
BlockCipherOutputStream(OutputStream stream, Cipher cipher)
          Construct a BlockCipherOutputStream around the supplied stream and encrypt output data with the supplied cipher.
 
Method Summary
 void flush()
          
 void write(byte[] abData, int nOffset, int nLength)
          
 void write(int bData)
          
protected  void writeBlock()
          Write the current clear block to the wrapped stream.
 
Methods inherited from class java.io.FilterOutputStream
close, write
 

Field Detail

m_cipher

protected Cipher m_cipher
The Encryption Cipher


m_abBlockClear

protected byte[] m_abBlockClear
The current block of unencrypted data


m_nBlockIndex

protected int m_nBlockIndex
The next available index to write into the unencrypted data block.

Constructor Detail

BlockCipherOutputStream

public BlockCipherOutputStream(OutputStream stream,
                               Cipher cipher)
Construct a BlockCipherOutputStream around the supplied stream and encrypt output data with the supplied cipher.

Parameters:
stream - the stream to write encrypted data to
cipher - the cipher to use to encrypt data
Method Detail

flush

public void flush()
           throws IOException

Specified by:
flush in interface Flushable
Overrides:
flush in class FilterOutputStream
Throws:
IOException

write

public void write(int bData)
           throws IOException

Overrides:
write in class FilterOutputStream
Throws:
IOException

write

public void write(byte[] abData,
                  int nOffset,
                  int nLength)
           throws IOException

Overrides:
write in class FilterOutputStream
Throws:
IOException

writeBlock

protected void writeBlock()
                   throws IOException
Write the current clear block to the wrapped stream.

Throws:
IOException

CoherenceTM v3.3
Copyright© 2000-2007 by Oracle Corporation