com.twelvemonkeys.io
Class CompoundReader

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

public class CompoundReader
extends java.io.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  java.lang.Object finalLock
           
protected  boolean markSupported
           
 
Fields inherited from class java.io.Reader
lock
 
Constructor Summary
CompoundReader(java.util.Iterator<java.io.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  java.io.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 java.lang.Object finalLock

markSupported

protected final boolean markSupported
Constructor Detail

CompoundReader

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

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

nextReader

protected final java.io.Reader nextReader()

ensureOpen

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

Throws:
java.io.IOException - if the stream is closed

close

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

mark

public void mark(int pReadLimit)
          throws java.io.IOException
Overrides:
mark in class java.io.Reader
Throws:
java.io.IOException

reset

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

markSupported

public boolean markSupported()
Overrides:
markSupported in class java.io.Reader

read

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

read

public int read(char[] pBuffer,
                int pOffset,
                int pLength)
         throws java.io.IOException
Specified by:
read in class java.io.Reader
Throws:
java.io.IOException

ready

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

skip

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


Copyright © 2014. All Rights Reserved.