infoservice
Class InfoServiceConnectionReader

java.lang.Object
  extended by infoservice.InfoServiceConnectionReader

public class InfoServiceConnectionReader
extends java.lang.Object

This is the implementation for reading data from an InputStream with a limitof bytes maximally read.


Field Summary
private  int m_byteLimit
          This stores the currently number of bytes which can be read from the InputStream until the data limit is exhausted.
private  java.io.InputStream m_inputStream
          This stores the InputStream where the data is read from.
 
Constructor Summary
InfoServiceConnectionReader(java.io.InputStream a_inputStream, int a_byteLimit)
          Constructs a new InfoServiceConnectionReader with a read-limitation for an InputStream.
 
Method Summary
 int read()
          Reads one byte from the underlying InputStream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_inputStream

private java.io.InputStream m_inputStream
This stores the InputStream where the data is read from.


m_byteLimit

private int m_byteLimit
This stores the currently number of bytes which can be read from the InputStream until the data limit is exhausted.

Constructor Detail

InfoServiceConnectionReader

public InfoServiceConnectionReader(java.io.InputStream a_inputStream,
                                   int a_byteLimit)
Constructs a new InfoServiceConnectionReader with a read-limitation for an InputStream.

Parameters:
a_inputStream - The InputStream where the data shall be read from.
a_byteLimit - The maximum number of bytes allowed to read from the stream.
Method Detail

read

public int read()
         throws java.lang.Exception
Reads one byte from the underlying InputStream. If the call is successful, the limit of bytes able to read from the stream is also decremented by 1. If the end of the stream is reached or there was an exception while reading from the stream, the byte limit is not decremented. In the case of a read exception, this exception is thrown. If the byte limit is exhausted, also an exception is thrown.

Returns:
The byte read from the stream or -1, if the end of the stream was reached.
Throws:
java.lang.Exception