client
Class ClientInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by client.ClientInputStream
All Implemented Interfaces:
java.io.Closeable

final class ClientInputStream
extends java.io.InputStream

InputStream used by user (application) to receive (anonymized) data via the mix cascade. Abstracts from the underlying technique.

Author:
Karl-Peter Fuchs

Field Summary
private  Client client
          Reference on the Client using this Stream.
private  boolean isClosed
          Indicates whether this InputStream is ready to use or not.
 
Constructor Summary
protected ClientInputStream(Client client)
          Generates a new InputStream that can be used to receive (anonymized) data via the mix cascade.
 
Method Summary
 void close()
          Closes this InputStream.
 int read()
          Reads a byte of data from this InputStream.
 int read(byte[] b)
          Reads up to b.length bytes of data from this InputStream.
 int read(byte[] b, int off, int len)
          Reads up to len bytes of data from this InputStream.
 long skip(long n)
          Skips over and discards n bytes of data from this InputStream.
 
Methods inherited from class java.io.InputStream
available, mark, markSupported, reset
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

isClosed

private boolean isClosed
Indicates whether this InputStream is ready to use or not.


client

private Client client
Reference on the Client using this Stream.

Constructor Detail

ClientInputStream

protected ClientInputStream(Client client)
Generates a new InputStream that can be used to receive (anonymized) data via the mix cascade.

Parameters:
client - Reference on the Client using this Stream.
Method Detail

read

public int read()
         throws java.io.IOException
Reads a byte of data from this InputStream.

Specified by:
read in class java.io.InputStream
Returns:
The next byte of data, or "-1" if EOF or this InputStream was already closed.
Throws:
java.io.IOException - If an I/O error occurs.

read

public int read(byte[] b)
         throws java.io.IOException
Reads up to b.length bytes of data from this InputStream. Blocks until input is available.

Overrides:
read in class java.io.InputStream
Parameters:
b - Buffer to read data to.
Returns:
Number of bytes read (or "-1" when EOF or InputStream closed).
Throws:
java.io.IOException - If an I/O error occurs.

read

public int read(byte[] b,
                int off,
                int len)
         throws java.io.IOException
Reads up to len bytes of data from this InputStream. If len is not zero, the method blocks until some input is available; otherwise, no bytes are read and 0 is returned.

Overrides:
read in class java.io.InputStream
Parameters:
b - Buffer to read data to.
off - Start offset in the destination array b.
len - Maximum number of bytes to be read.
Returns:
Number of bytes read (or "-1" when EOF or InputStream closed).
Throws:
java.io.IOException - If an I/O error occurs.

skip

public long skip(long n)
          throws java.io.IOException
Skips over and discards n bytes of data from this InputStream.

Overrides:
skip in class java.io.InputStream
Parameters:
n - Number of bytes to be skipped over.
Returns:
Number of bytes skipped over.
Throws:
java.io.IOException - If an I/O error occurs.

close

public void close()
           throws java.io.IOException
Closes this InputStream.

Specified by:
close in interface java.io.Closeable
Overrides:
close in class java.io.InputStream
Throws:
java.io.IOException - If an I/O error occurs.