Package com.twelvemonkeys.io
Class CompoundReader
- java.lang.Object
-
- java.io.Reader
-
- com.twelvemonkeys.io.CompoundReader
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
,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
Fields Modifier and Type Field Description protected java.lang.Object
finalLock
protected boolean
markSupported
-
Constructor Summary
Constructors Constructor Description CompoundReader(java.util.Iterator<java.io.Reader> pReaders)
Create a new compound reader.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
protected void
ensureOpen()
Check to make sure that the stream has not been closedvoid
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)
-
-
-
Constructor Detail
-
CompoundReader
public CompoundReader(java.util.Iterator<java.io.Reader> pReaders)
Create a new compound reader.- Parameters:
pReaders
-Iterator
containtingReader
s, providing the character stream.- Throws:
java.lang.NullPointerException
- ifpReaders
isnull
, or any of the elements in the iterator isnull
.java.lang.ClassCastException
- if any element of the iterator is not ajava.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 interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Specified by:
close
in classjava.io.Reader
- Throws:
java.io.IOException
-
mark
public void mark(int pReadLimit) throws java.io.IOException
- Overrides:
mark
in classjava.io.Reader
- Throws:
java.io.IOException
-
reset
public void reset() throws java.io.IOException
- Overrides:
reset
in classjava.io.Reader
- Throws:
java.io.IOException
-
markSupported
public boolean markSupported()
- Overrides:
markSupported
in classjava.io.Reader
-
read
public int read() throws java.io.IOException
- Overrides:
read
in classjava.io.Reader
- Throws:
java.io.IOException
-
read
public int read(char[] pBuffer, int pOffset, int pLength) throws java.io.IOException
- Specified by:
read
in classjava.io.Reader
- Throws:
java.io.IOException
-
ready
public boolean ready() throws java.io.IOException
- Overrides:
ready
in classjava.io.Reader
- Throws:
java.io.IOException
-
skip
public long skip(long pChars) throws java.io.IOException
- Overrides:
skip
in classjava.io.Reader
- Throws:
java.io.IOException
-
-