com.ctc.wstx.io
Class MergedReader

java.lang.Object
  extended by java.io.Reader
      extended by com.ctc.wstx.io.MergedReader
All Implemented Interfaces:
Closeable, Readable

public final class MergedReader
extends Reader

Simple Reader implementation that is used to "unwind" some data previously read from a Reader; so that as long as some of that data remains, it's returned; but as long as it's read, we'll just use data from the underlying original Reader. This is similar to PushbackReader, but with this class there's only one implicit pushback, when instance is constructed; not general pushback buffer and methods to use it.


Field Summary
 
Fields inherited from class java.io.Reader
lock
 
Constructor Summary
MergedReader(ReaderConfig cfg, Reader in, char[] buf, int start, int end)
           
 
Method Summary
 void close()
           
 void mark(int readlimit)
           
 boolean markSupported()
           
 int read()
           
 int read(char[] cbuf)
           
 int read(char[] cbuf, int off, int len)
           
 boolean ready()
           
 void reset()
           
 long skip(long n)
           
 
Methods inherited from class java.io.Reader
read
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MergedReader

public MergedReader(ReaderConfig cfg,
                    Reader in,
                    char[] buf,
                    int start,
                    int end)
Method Detail

close

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

mark

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

markSupported

public boolean markSupported()
Overrides:
markSupported in class Reader

read

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

read

public int read(char[] cbuf)
         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

ready

public boolean ready()
              throws IOException
Overrides:
ready in class Reader
Throws:
IOException

reset

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

skip

public long skip(long n)
          throws IOException
Overrides:
skip in class Reader
Throws:
IOException