Bouncy Castle Cryptography Library 1.49

org.bouncycastle.crypto.io
Class CipherInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by java.io.FilterInputStream
          extended by org.bouncycastle.crypto.io.CipherInputStream
All Implemented Interfaces:
java.io.Closeable

public class CipherInputStream
extends java.io.FilterInputStream

A CipherInputStream is composed of an InputStream and a BufferedBlockCipher so that read() methods return data that are read in from the underlying InputStream but have been additionally processed by the Cipher. The Cipher must be fully initialized before being used by a CipherInputStream.

For example, if the Cipher is initialized for decryption, the CipherInputStream will attempt to read in data and decrypt them, before returning the decrypted data.


Field Summary
 
Fields inherited from class java.io.FilterInputStream
in
 
Constructor Summary
CipherInputStream(java.io.InputStream is, BufferedBlockCipher cipher)
          Constructs a CipherInputStream from an InputStream and a BufferedBlockCipher.
CipherInputStream(java.io.InputStream is, StreamCipher cipher)
           
 
Method Summary
 int available()
           
 void close()
           
 boolean markSupported()
           
 int read()
           
 int read(byte[] b)
           
 int read(byte[] b, int off, int len)
           
 long skip(long n)
           
 
Methods inherited from class java.io.FilterInputStream
mark, reset
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CipherInputStream

public CipherInputStream(java.io.InputStream is,
                         BufferedBlockCipher cipher)
Constructs a CipherInputStream from an InputStream and a BufferedBlockCipher.


CipherInputStream

public CipherInputStream(java.io.InputStream is,
                         StreamCipher cipher)
Method Detail

read

public int read()
         throws java.io.IOException
Overrides:
read in class java.io.FilterInputStream
Throws:
java.io.IOException

read

public int read(byte[] b)
         throws java.io.IOException
Overrides:
read in class java.io.FilterInputStream
Throws:
java.io.IOException

read

public int read(byte[] b,
                int off,
                int len)
         throws java.io.IOException
Overrides:
read in class java.io.FilterInputStream
Throws:
java.io.IOException

skip

public long skip(long n)
          throws java.io.IOException
Overrides:
skip in class java.io.FilterInputStream
Throws:
java.io.IOException

available

public int available()
              throws java.io.IOException
Overrides:
available in class java.io.FilterInputStream
Throws:
java.io.IOException

close

public void close()
           throws java.io.IOException
Specified by:
close in interface java.io.Closeable
Overrides:
close in class java.io.FilterInputStream
Throws:
java.io.IOException

markSupported

public boolean markSupported()
Overrides:
markSupported in class java.io.FilterInputStream

Bouncy Castle Cryptography Library 1.49