com.twelvemonkeys.io
Class CompoundReader

java.lang.Object
  extended by java.io.Reader
      extended by com.twelvemonkeys.io.CompoundReader
All Implemented Interfaces:
Closeable, Readable

public class CompoundReader
extends Reader

A Reader implementation that can read from multiple sources.

Version:
$Id: //depot/branches/personal/haraldk/twelvemonkeys/release-2/twelvemonkeys-core/src/main/java/com/twelvemonkeys/io/CompoundReader.java#2 $
Author:
Harald Kuhr, last modified by $Author: haku $

Field Summary
protected  Object finalLock
           
protected  boolean markSupported
           
 
Fields inherited from class java.io.Reader
lock
 
Constructor Summary
CompoundReader(Iterator<Reader> pReaders)
          Create a new compound reader.
 
Method Summary
 void close()
           
protected  void ensureOpen()
          Check to make sure that the stream has not been closed
 void mark(int pReadLimit)
           
 boolean markSupported()
           
protected  Reader nextReader()
           
 int read()
           
 int read(char[] pBuffer, int pOffset, int pLength)
           
 boolean ready()
           
 void reset()
           
 long skip(long pChars)
           
 
Methods inherited from class java.io.Reader
read, read
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

finalLock

protected final Object finalLock

markSupported

protected final boolean markSupported
Constructor Detail

CompoundReader

public CompoundReader(Iterator<Reader> pReaders)
Create a new compound reader.

Parameters:
pReaders - Iterator containting Readers, providing the character stream.
Throws:
NullPointerException - if pReaders is null, or any of the elements in the iterator is null.
ClassCastException - if any element of the iterator is not a java.io.Reader
Method Detail

nextReader

protected final Reader nextReader()

ensureOpen

protected final void ensureOpen()
                         throws IOException
Check to make sure that the stream has not been closed

Throws:
IOException - if the stream is closed

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 pReadLimit)
          throws IOException
Overrides:
mark in class Reader
Throws:
IOException

reset

public void reset()
           throws IOException
Overrides:
reset 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[] pBuffer,
                int pOffset,
                int pLength)
         throws IOException
Specified by:
read in class Reader
Throws:
IOException

ready

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

skip

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


Copyright © 2015. All Rights Reserved.