com.cometway.io
Class FixedLengthReader

java.lang.Object
  extended by java.io.InputStream
      extended by com.cometway.io.ReaderInputStream
          extended by com.cometway.io.FixedLengthReader
All Implemented Interfaces:
java.io.Closeable

public class FixedLengthReader
extends ReaderInputStream

This subclass of ReaderInputStream is a wrapper for a Reader that limits the number of bytes that can be read from this InputStream.


Field Summary
 boolean allowStreamClose
           
 
Fields inherited from class com.cometway.io.ReaderInputStream
reader
 
Constructor Summary
FixedLengthReader(java.io.Reader reader, int readLimit)
           
 
Method Summary
 void close()
           
 int read()
           
 int read(byte[] in)
           
 int read(byte[] in, int a, int b)
           
 
Methods inherited from class com.cometway.io.ReaderInputStream
available, mark, markSupported, reset, skip
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

allowStreamClose

public boolean allowStreamClose
Constructor Detail

FixedLengthReader

public FixedLengthReader(java.io.Reader reader,
                         int readLimit)
Method Detail

read

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

read

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

read

public int read(byte[] in,
                int a,
                int b)
         throws java.io.IOException
Overrides:
read in class ReaderInputStream
Throws:
java.io.IOException

close

public void close()
           throws java.io.IOException
Specified by:
close in interface java.io.Closeable
Overrides:
close in class ReaderInputStream
Throws:
java.io.IOException