org.tranche.streams
Class AESEncodingStream

java.lang.Object
  extended by java.io.OutputStream
      extended by org.tranche.streams.AESEncodingStream
All Implemented Interfaces:
java.io.Closeable, java.io.Flushable

public class AESEncodingStream
extends java.io.OutputStream

Encrypted file output stream.

Author:
Jayson Falkner - jfalkner@umich.edu

Constructor Summary
AESEncodingStream(java.lang.String passphrase, byte[] salt, int iterations, java.io.OutputStream out)
           
AESEncodingStream(java.lang.String passphrase, java.io.OutputStream out)
           
 
Method Summary
 void close()
          Close the output stream.
 void flush()
          Flush the output stream.
 BigHash getHash()
          Get the hash of the file written to the output stream..
 void write(byte[] b)
          Write bytes to the output stream.
 void write(byte[] buf, int off, int len)
          Write to the output stream.
 void write(int b)
          Write a byte to the output stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AESEncodingStream

public AESEncodingStream(java.lang.String passphrase,
                         java.io.OutputStream out)
                  throws java.io.IOException
Parameters:
passphrase -
out -
Throws:
java.io.IOException

AESEncodingStream

public AESEncodingStream(java.lang.String passphrase,
                         byte[] salt,
                         int iterations,
                         java.io.OutputStream out)
                  throws java.io.IOException
Parameters:
passphrase -
salt -
iterations -
out -
Throws:
java.io.IOException
Method Detail

write

public void write(byte[] buf,
                  int off,
                  int len)
           throws java.io.IOException

Write to the output stream.

Overrides:
write in class java.io.OutputStream
Parameters:
buf -
off -
len -
Throws:
java.io.IOException

write

public void write(byte[] b)
           throws java.io.IOException

Write bytes to the output stream.

Overrides:
write in class java.io.OutputStream
Parameters:
b -
Throws:
java.io.IOException

write

public void write(int b)
           throws java.io.IOException

Write a byte to the output stream.

Specified by:
write in class java.io.OutputStream
Parameters:
b -
Throws:
java.io.IOException

getHash

public BigHash getHash()
                throws java.io.IOException

Get the hash of the file written to the output stream..

Returns:
Throws:
java.io.IOException

close

public void close()
           throws java.io.IOException

Close the output stream.

Specified by:
close in interface java.io.Closeable
Overrides:
close in class java.io.OutputStream
Throws:
java.io.IOException

flush

public void flush()
           throws java.io.IOException

Flush the output stream.

Specified by:
flush in interface java.io.Flushable
Overrides:
flush in class java.io.OutputStream
Throws:
java.io.IOException


This code is free for use both commercially and non-commercially as stated in the project's license