Package com.google.common.io
Class MultiReader
- java.lang.Object
-
- java.io.Reader
-
- com.google.common.io.MultiReader
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable,java.lang.Readable
class MultiReader extends java.io.ReaderAReaderthat concatenates multiple readers.- Since:
- 1.0
-
-
Field Summary
Fields Modifier and Type Field Description private java.io.Readercurrentprivate java.util.Iterator<? extends CharSource>it
-
Constructor Summary
Constructors Constructor Description MultiReader(java.util.Iterator<? extends CharSource> readers)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidadvance()Closes the current reader and opens the next one, if any.voidclose()intread(char[] cbuf, int off, int len)booleanready()longskip(long n)
-
-
-
Field Detail
-
it
private final java.util.Iterator<? extends CharSource> it
-
current
private java.io.Reader current
-
-
Constructor Detail
-
MultiReader
MultiReader(java.util.Iterator<? extends CharSource> readers) throws java.io.IOException
- Throws:
java.io.IOException
-
-
Method Detail
-
advance
private void advance() throws java.io.IOExceptionCloses the current reader and opens the next one, if any.- Throws:
java.io.IOException
-
read
public int read(char[] cbuf, int off, int len) throws java.io.IOException- Specified by:
readin classjava.io.Reader- Throws:
java.io.IOException
-
skip
public long skip(long n) throws java.io.IOException- Overrides:
skipin classjava.io.Reader- Throws:
java.io.IOException
-
ready
public boolean ready() throws java.io.IOException- Overrides:
readyin classjava.io.Reader- Throws:
java.io.IOException
-
close
public void close() throws java.io.IOException- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Specified by:
closein classjava.io.Reader- Throws:
java.io.IOException
-
-