xsul.http_common
Class FixedLengthInputStream

java.lang.Object
  extended byjava.io.InputStream
      extended byxsul.http_common.FixedLengthInputStream

public class FixedLengthInputStream
extends java.io.InputStream

This is specialization of input stream that is guaranteed to read exactly number of bytes specified as input parameeter from underlying input stream - even if stream is closed before all bytes are read close() will read reamining bytes and WILL NOT call close() on underlying stream.

Version:
$Revision: 1.4 $
Author:
Aleksander Slominski

Constructor Summary
FixedLengthInputStream(java.io.InputStream input, int streamSize)
           
 
Method Summary
 void close()
           
 int read()
           
 int read(byte[] buf, int offset, int length)
           
 
Methods inherited from class java.io.InputStream
available, mark, markSupported, read, reset, skip
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FixedLengthInputStream

public FixedLengthInputStream(java.io.InputStream input,
                              int streamSize)
                       throws java.lang.IllegalArgumentException
Method Detail

read

public int read()
         throws java.io.IOException
Throws:
java.io.IOException

read

public int read(byte[] buf,
                int offset,
                int length)
         throws java.io.IOException
Throws:
java.io.IOException

close

public void close()
           throws java.io.IOException
Throws:
java.io.IOException


IU Extreme! Lab (http://www.extreme.indiana.edu)