Rice Pastry API

rice.p2p.util
Class EncryptedOutputStream

java.lang.Object
  extended by java.io.OutputStream
      extended by rice.p2p.util.EncryptedOutputStream
All Implemented Interfaces:
java.io.Closeable, java.io.Flushable

public class EncryptedOutputStream
extends java.io.OutputStream

Version:
$Id: EncryptedOutputStream.java 3524 2007-01-09 14:09:27Z jeffh $
Author:
Alan Mislove

Field Summary
protected  byte[] buffer
           
 int BUFFER_SIZE
           
protected  int bufferLength
           
protected  byte[] key
           
protected  java.security.PublicKey publicKey
           
protected  java.io.DataOutputStream stream
           
 
Constructor Summary
EncryptedOutputStream(java.security.PublicKey publicKey, java.io.OutputStream stream, int bufferSize)
          Builds an encrypted outputstream given a public key to encrypt thing under
 
Method Summary
 void close()
          Closes this output stream and releases any system resources associated with this stream.
 void flush()
          Flushes this output stream and forces any buffered output bytes to be written out.
 void write(byte[] b, int off, int len)
          Writes the given bytes to the output
 void write(int b)
          Writes the specified byte to this output stream.
protected  void writeBuffer()
          Internal method which writes out the buffered data
 
Methods inherited from class java.io.OutputStream
write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BUFFER_SIZE

public final int BUFFER_SIZE

publicKey

protected java.security.PublicKey publicKey

key

protected byte[] key

stream

protected java.io.DataOutputStream stream

buffer

protected byte[] buffer

bufferLength

protected int bufferLength
Constructor Detail

EncryptedOutputStream

public EncryptedOutputStream(java.security.PublicKey publicKey,
                             java.io.OutputStream stream,
                             int bufferSize)
                      throws java.io.IOException
Builds an encrypted outputstream given a public key to encrypt thing under

Parameters:
key - The key
stream - The underlying stream
Throws:
java.io.IOException
Method Detail

write

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

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

write

public void write(byte[] b,
                  int off,
                  int len)
           throws java.io.IOException
Writes the given bytes to the output

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

writeBuffer

protected void writeBuffer()
                    throws java.io.IOException
Internal method which writes out the buffered data

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.

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

close

public void close()
           throws java.io.IOException
Closes this output stream and releases any system resources associated with this stream.

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

Rice Pastry API

Copyright © 2001-2005 - Rice Pastry.


Imprint-Dataprotection