org.apache.fulcrum.jce.crypto
Class SmartDecryptingInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by java.io.ByteArrayInputStream
          extended by org.apache.fulcrum.jce.crypto.SmartDecryptingInputStream
All Implemented Interfaces:
java.io.Closeable

public class SmartDecryptingInputStream
extends java.io.ByteArrayInputStream

An input stream that determine if the originating input stream was encrypted or not. This magic only works for text files though.

Author:
Siegfried Goeschl

Field Summary
 
Fields inherited from class java.io.ByteArrayInputStream
buf, count, mark, pos
 
Constructor Summary
SmartDecryptingInputStream(CryptoStreamFactory cryptoStreamFactory, java.io.InputStream is)
          Constructor
SmartDecryptingInputStream(CryptoStreamFactory cryptoStreamFactory, java.io.InputStream is, char[] password)
          Constructor
 
Method Summary
 void copy(java.io.InputStream is, java.io.OutputStream os)
          Pumps the input stream to the output stream.
 
Methods inherited from class java.io.ByteArrayInputStream
available, close, mark, markSupported, read, read, reset, skip
 
Methods inherited from class java.io.InputStream
read
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SmartDecryptingInputStream

public SmartDecryptingInputStream(CryptoStreamFactory cryptoStreamFactory,
                                  java.io.InputStream is)
                           throws java.io.IOException,
                                  java.security.GeneralSecurityException
Constructor

Parameters:
cryptoStreamFactory - the CryptoStreamFactory for creating a cipher stream
is - the input stream to be decrypted
Throws:
java.io.IOException
java.security.GeneralSecurityException

SmartDecryptingInputStream

public SmartDecryptingInputStream(CryptoStreamFactory cryptoStreamFactory,
                                  java.io.InputStream is,
                                  char[] password)
                           throws java.io.IOException,
                                  java.security.GeneralSecurityException
Constructor

Parameters:
cryptoStreamFactory - the CryptoStreamFactory for creating a cipher stream
is - the input stream to be decrypted
password - the password for decryption
Throws:
java.io.IOException
java.security.GeneralSecurityException
Method Detail

copy

public void copy(java.io.InputStream is,
                 java.io.OutputStream os)
          throws java.io.IOException
Pumps the input stream to the output stream.

Parameters:
is - the source input stream
os - the target output stream
Throws:
java.io.IOException - the copying failed


Copyright © 2000-2011 Apache Software Foundation. All Rights Reserved.