Rice Pastry API

rice.p2p.util
Class EncryptedInputStream

java.lang.Object
  extended byjava.io.InputStream
      extended byrice.p2p.util.EncryptedInputStream

public class EncryptedInputStream
extends java.io.InputStream

Version:
$Id: EncryptedInputStream.java 2302 2005-03-11 00:58:26Z jeffh $
Author:
Alan Mislove

Field Summary
protected  byte[] buffer
          DESCRIBE THE FIELD
protected  int bufferLength
          DESCRIBE THE FIELD
protected  byte[] key
          DESCRIBE THE FIELD
protected  java.security.PrivateKey privateKey
          DESCRIBE THE FIELD
protected  java.io.DataInputStream stream
          DESCRIBE THE FIELD
 
Constructor Summary
EncryptedInputStream(java.security.PrivateKey privateKey, java.io.InputStream stream)
          Builds an encrypted inputstream given a private key to decrypt thing under
 
Method Summary
 int available()
          Returns the number of bytes that can be read (or skipped over) from this input stream without blocking by the next caller of a method for this input stream.
 void close()
          Closes this input stream and releases any system resources associated with the stream.
 int read()
          Reads the next byte of data from the input stream.
 int read(byte[] b, int off, int len)
          Reads up to len bytes of data from the input stream into an array of bytes.
protected  void readBuffer()
          Internal method which reads in the next chunk of buffered data
 
Methods inherited from class java.io.InputStream
mark, markSupported, read, reset, skip
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

privateKey

protected java.security.PrivateKey privateKey
DESCRIBE THE FIELD


key

protected byte[] key
DESCRIBE THE FIELD


stream

protected java.io.DataInputStream stream
DESCRIBE THE FIELD


buffer

protected byte[] buffer
DESCRIBE THE FIELD


bufferLength

protected int bufferLength
DESCRIBE THE FIELD

Constructor Detail

EncryptedInputStream

public EncryptedInputStream(java.security.PrivateKey privateKey,
                            java.io.InputStream stream)
                     throws java.io.IOException
Builds an encrypted inputstream given a private key to decrypt thing under

Parameters:
stream - The underlying stream
privateKey - DESCRIBE THE PARAMETER
Throws:
java.io.IOException - DESCRIBE THE EXCEPTION
Method Detail

read

public int read()
         throws java.io.IOException
Reads the next byte of data from the input stream. T

Returns:
the next byte of data, or -1 if the end of the stream is reached.
Throws:
java.io.IOException - DESCRIBE THE EXCEPTION

read

public int read(byte[] b,
                int off,
                int len)
         throws java.io.IOException
Reads up to len bytes of data from the input stream into an array of bytes. An attempt is made to read as many as len bytes, but a smaller number may be read, possibly zero. The number of bytes actually read is returned as an integer.

Parameters:
b - the buffer into which the data is read.
off - the start offset in array b at which the data is written.
len - the maximum number of bytes to read.
Returns:
the total number of bytes read into the buffer, or -1 if there is no more data because the end of the stream has been reached.
Throws:
java.io.IOException - DESCRIBE THE EXCEPTION

readBuffer

protected void readBuffer()
                   throws java.io.IOException
Internal method which reads in the next chunk of buffered data

Throws:
java.io.IOException - DESCRIBE THE EXCEPTION

available

public int available()
              throws java.io.IOException
Returns the number of bytes that can be read (or skipped over) from this input stream without blocking by the next caller of a method for this input stream. The next caller might be the same thread or or another thread.

Returns:
the number of bytes that can be read from this input stream without blocking.
Throws:
java.io.IOException - if an I/O error occurs.

close

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

Throws:
java.io.IOException - if an I/O error occurs.

Rice Pastry API

Copyright © 2001-2005 - Rice Pastry.


Imprint-Dataprotection