org.apache.jackrabbit.mk.util
Class BoundedInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by java.io.FilterInputStream
          extended by org.apache.jackrabbit.mk.util.BoundedInputStream
All Implemented Interfaces:
Closeable

public class BoundedInputStream
extends FilterInputStream

Implementation of an InputStream that is bounded by a limit and will return -1 on reads when this limit is exceeded.


Field Summary
 
Fields inherited from class java.io.FilterInputStream
in
 
Constructor Summary
BoundedInputStream(InputStream in, int limit)
          Create a new instance of this class.
 
Method Summary
 void close()
          Close this input stream.
 int read()
           
 int read(byte[] b, int off, int len)
           
 
Methods inherited from class java.io.FilterInputStream
available, mark, markSupported, read, reset, skip
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BoundedInputStream

public BoundedInputStream(InputStream in,
                          int limit)
Create a new instance of this class.

Parameters:
in - input stream
limit - limit
Method Detail

read

public int read()
         throws IOException
Overrides:
read in class FilterInputStream
Throws:
IOException

read

public int read(byte[] b,
                int off,
                int len)
         throws IOException
Overrides:
read in class FilterInputStream
Throws:
IOException

close

public void close()
           throws IOException
Close this input stream. Finishes reading any pending chunks until the last chunk is received. Does not close the underlying input stream.

Specified by:
close in interface Closeable
Overrides:
close in class FilterInputStream
Throws:
IOException
See Also:
FilterInputStream.close()


Copyright © 2012 The Apache Software Foundation. All Rights Reserved.