org.apache.maven.shared.filtering
Class BoundedReader

java.lang.Object
  extended by java.io.Reader
      extended by org.apache.maven.shared.filtering.BoundedReader
All Implemented Interfaces:
Closeable, Readable

public class BoundedReader
extends Reader

A reader that imposes a limit to the number of bytes that can be read from an underlying reader, simulating eof when this limit is reached. This stream can typically be used to constrain a client with regard to a readAheadLimit of an underlying stream, to avoid overrunning this limit and hence lose the opportunity do to reset.


Field Summary
 
Fields inherited from class java.io.Reader
lock
 
Constructor Summary
BoundedReader(Reader target, int readAheadLimit)
           
 
Method Summary
 void close()
           
 void mark(int readAheadLimit)
           
 int read()
           
 int read(char[] cbuf, int off, int len)
           
 void reset()
           
 
Methods inherited from class java.io.Reader
markSupported, read, read, ready, skip
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BoundedReader

public BoundedReader(Reader target,
                     int readAheadLimit)
              throws IOException
Throws:
IOException
Method Detail

close

public void close()
           throws IOException
Specified by:
close in interface Closeable
Specified by:
close in class Reader
Throws:
IOException

reset

public void reset()
           throws IOException
Overrides:
reset in class Reader
Throws:
IOException

mark

public void mark(int readAheadLimit)
          throws IOException
Overrides:
mark in class Reader
Throws:
IOException

read

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

read

public int read(char[] cbuf,
                int off,
                int len)
         throws IOException
Specified by:
read in class Reader
Throws:
IOException


Copyright © 2002–2014 The Apache Software Foundation. All rights reserved.