Package org.codehaus.commons.io
Class MultiReader
- java.lang.Object
-
- java.io.Reader
-
- org.codehaus.commons.io.MultiReader
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
,java.lang.Readable
public class MultiReader extends java.io.Reader
Similar toFilterReader
, but when the first delegate is at end-of-input, it continues with reading from the next delegate.This
Reader
does not support MARK.
-
-
Field Summary
Fields Modifier and Type Field Description private java.io.Reader
currentDelegate
private java.util.Iterator<java.io.Reader>
delegateIterator
private java.util.List<java.io.Reader>
delegates
private static java.io.Reader
EMPTY_READER
-
Constructor Summary
Constructors Constructor Description MultiReader(java.io.Reader[] delegates)
MultiReader(java.util.List<java.io.Reader> delegates)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Closes all delegates.int
read()
int
read(char[] cbuf, int off, int len)
long
skip(long n)
-
-
-
Method Detail
-
close
public void close() throws java.io.IOException
Closes all delegates.- 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
-
read
public int read() throws java.io.IOException
- Overrides:
read
in classjava.io.Reader
- Throws:
java.io.IOException
-
skip
public long skip(long n) throws java.io.IOException
- Overrides:
skip
in classjava.io.Reader
- Throws:
java.io.IOException
-
read
public int read(char[] cbuf, int off, int len) throws java.io.IOException
- Specified by:
read
in classjava.io.Reader
- Throws:
java.io.IOException
-
-