public class MultiStream
extends java.io.FilterInputStream
When instantiated, the MultiStream object has no connection to any
input stream. If read()
method is called while in this
state, -1
is returned signalling EOF condition.
Once the switchTo
method is called, read()
delegates the work to the read()
method of the current
underlying input stream.
This class may be useful in many situations. For instance, PushbackInputStream can provide pushback functionality for multiple underlying streams at once in an efficient way.
Constructor and Description |
---|
MultiStream()
Constructor.
|
Modifier and Type | Method and Description |
---|---|
int |
read()
Reads the next byte from the current stream.
|
void |
switchTo(java.io.InputStream in)
Switches input to the specified stream.
|
public MultiStream()
public void switchTo(java.io.InputStream in)
in
- an input stream of any kind to be switched to.public int read() throws java.io.IOException
read
in class java.io.FilterInputStream
java.io.IOException