Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.apache.derby.iapi.services.io
Class LimitInputStream  view LimitInputStream download LimitInputStream.java

java.lang.Object
  extended byjava.io.InputStream
      extended byjava.io.FilterInputStream
          extended byorg.apache.derby.iapi.services.io.LimitInputStream
All Implemented Interfaces:
java.io.Closeable, Limit

public class LimitInputStream
extends java.io.FilterInputStream
implements Limit

An abstract InputStream that provides abstract methods to limit the range that can be read from the stream.


Field Summary
protected  boolean limitInPlace
           
protected  int remainingBytes
           
 
Fields inherited from class java.io.FilterInputStream
in
 
Constructor Summary
LimitInputStream(java.io.InputStream in)
          Construct a LimitInputStream and call the clearLimit() method.
 
Method Summary
 int available()
          Calls the in.available() method.
 int clearLimit()
          Clear any limit set by setLimit.
 int read()
          Calls the in.read() method
 int read(byte[] b, int off, int len)
          Calls the in.read(byte[], int, int) method.
 void setInput(java.io.InputStream in)
           
 void setLimit(int length)
          Set the limit of the stream that can be read.
 long skip(long count)
          Calls the in.skip(long) method
 
Methods inherited from class java.io.FilterInputStream
close, mark, markSupported, read, reset
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

remainingBytes

protected int remainingBytes

limitInPlace

protected boolean limitInPlace
Constructor Detail

LimitInputStream

public LimitInputStream(java.io.InputStream in)
Construct a LimitInputStream and call the clearLimit() method.

Method Detail

read

public int read()
         throws java.io.IOException
Description copied from class: java.io.FilterInputStream
Calls the in.read() method


read

public int read(byte[] b,
                int off,
                int len)
         throws java.io.IOException
Description copied from class: java.io.FilterInputStream
Calls the in.read(byte[], int, int) method.


skip

public long skip(long count)
          throws java.io.IOException
Description copied from class: java.io.FilterInputStream
Calls the in.skip(long) method


available

public int available()
              throws java.io.IOException
Description copied from class: java.io.FilterInputStream
Calls the in.available() method.


setLimit

public void setLimit(int length)
Set the limit of the stream that can be read. After this call up to and including length bytes can be read from or skipped in the stream. Any attempt to read more than length bytes will result in an EOFException

Specified by:
setLimit in interface Limit

clearLimit

public int clearLimit()
Clear any limit set by setLimit. After this call no limit checking will be made on any read until a setLimit()) call is made.

Specified by:
clearLimit in interface Limit

setInput

public void setInput(java.io.InputStream in)