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.Reader
AReader
that concatenates multiple readers.- Since:
- 1.0
-
-
Field Summary
Fields Modifier and Type Field Description private java.io.Reader
current
private 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 void
advance()
Closes the current reader and opens the next one, if any.void
close()
int
read(char[] cbuf, int off, int len)
boolean
ready()
long
skip(long n)
-
-
-
Field Detail
-
it
private final java.util.Iterator<? extends CharSource> it
-
current
@CheckForNull 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.IOException
Closes 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:
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
-
ready
public boolean ready() throws java.io.IOException
- Overrides:
ready
in classjava.io.Reader
- Throws:
java.io.IOException
-
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
-
-