com.pentec.util
Class ABufferedInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by java.io.FilterInputStream
          extended by java.io.BufferedInputStream
              extended by com.pentec.util.ABufferedInputStream
All Implemented Interfaces:
java.io.Closeable

public class ABufferedInputStream
extends java.io.BufferedInputStream

BufferedInputStream with a timeout (in milliseconds) built in rather than depending on the underlying source to provide one.


Field Summary
private  int iTimeout
          Amount of time to dwell on a read before timing out
 
Fields inherited from class java.io.BufferedInputStream
buf, count, marklimit, markpos, pos
 
Fields inherited from class java.io.FilterInputStream
in
 
Constructor Summary
ABufferedInputStream(java.io.InputStream in, int iTimeout)
           
ABufferedInputStream(java.io.InputStream in, int iSize, int iTimeout)
           
 
Method Summary
 int read()
           
 int read(byte[] abBuffer)
           
 int read(byte[] abBuffer, int iOffset, int iLength)
           
protected  void wait(int iBytes)
          Wait until iBytes number of bytes are available to read before returning.
 
Methods inherited from class java.io.BufferedInputStream
available, close, mark, markSupported, reset, skip
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

iTimeout

private int iTimeout
Amount of time to dwell on a read before timing out

Constructor Detail

ABufferedInputStream

public ABufferedInputStream(java.io.InputStream in,
                            int iTimeout)

ABufferedInputStream

public ABufferedInputStream(java.io.InputStream in,
                            int iSize,
                            int iTimeout)
Method Detail

read

public int read()
         throws java.io.IOException
Overrides:
read in class java.io.BufferedInputStream
Throws:
java.io.IOException

read

public int read(byte[] abBuffer)
         throws java.io.IOException
Overrides:
read in class java.io.FilterInputStream
Throws:
java.io.IOException

read

public int read(byte[] abBuffer,
                int iOffset,
                int iLength)
         throws java.io.IOException
Overrides:
read in class java.io.BufferedInputStream
Throws:
java.io.IOException

wait

protected void wait(int iBytes)
             throws java.io.IOException
Wait until iBytes number of bytes are available to read before returning. If the timeout period elapses, an IOException is thrown indicating so.

Parameters:
iBytes - number of bytes to wait on
Throws:
java.io.IOException - timeout period elapsed