SequenceInputStream
represents
the logical concatenation of other input
streams. It starts out with an ordered
collection of input streams and reads from
the first one until end of file is reached,
whereupon it reads from the second one,
and so on, until end of file is reached
on the last of the contained input streams.
Modifier and Type | Field and Description |
---|---|
private final Enumeration | |
private InputStream |
Access | Constructor and Description |
---|---|
public | SequenceInputStream(Enumeration<? extends InputStream>
an enumeration of input streams. e)Initializes a newly created |
public | SequenceInputStream(InputStream
the first input stream to read. s1, InputStream the second input stream to read. s2)Initializes a newly
created |
Modifier and Type | Method and Description |
---|---|
public int | Returns: an estimate of the number of bytes that can be read (or skipped over) from the current underlying input stream without blocking or0 if this input stream
has been closed by invoking its close() methodOverrides java. Returns an estimate of the number of bytes that can be read (or skipped over) from the current underlying input stream without blocking by the next invocation of a method for the current underlying input stream. |
public void | close()
Overrides java. Implements java. Closes this input stream and releases any system resources associated with the stream. |
pack-priv final void | |
private void | |
public int | Returns: the next byte of data, or-1 if the end of the
stream is reached.Implements abstract java. Reads the next byte of data from the input stream. |
public int | Returns: the total number of bytes read into the buffer, or-1 if there is no more data because the end of
the last contained stream has been reached.the buffer into which the data is read. b, int the start offset in array off, int b
at which the data is written.the maximum number of bytes read. len)Overrides java. Reads up to |
public long | transferTo(OutputStream
the output stream, non-null out)Overrides java. Reads all bytes from this input stream and writes the bytes to the given output stream in the order that they are read. |
e | back to summary |
---|---|
private final Enumeration<? extends InputStream> e |
in | back to summary |
---|---|
private InputStream in |
SequenceInputStream | back to summary |
---|---|
public SequenceInputStream(Enumeration<? extends InputStream> e) Initializes a newly created
|
SequenceInputStream | back to summary |
---|---|
public SequenceInputStream(InputStream s1, InputStream s2) Initializes a newly
created
|
available | back to summary |
---|---|
public int available() throws IOException Overrides java. Returns an estimate of the number of bytes that can be read (or skipped over) from the current underlying input stream without blocking by the next invocation of a method for the current underlying input stream. The next invocation might be the same thread or another thread. A single read or skip of this many bytes will not block, but may read or skip fewer bytes.
This method simply calls
|
close | back to summary |
---|---|
public void close() throws IOException Overrides java. Implements java. Doc from java. Closes this input stream and releases any system resources associated
with the stream.
A closed
If this stream was created
from an enumeration, all remaining elements
are requested from the enumeration and closed
before the
|
nextStream | back to summary |
---|---|
pack-priv final void nextStream() throws IOException Continues reading in the next stream if an EOF is reached. |
peekNextStream | back to summary |
---|---|
private void peekNextStream() |
read | back to summary |
---|---|
public int read() throws IOException Implements abstract java. Doc from java. Reads the next byte of data from the input stream. The value byte is
returned as an
This method
tries to read one byte from the current substream. If it
reaches the end of the stream, it calls the
|
read | back to summary |
---|---|
public int read(byte[] b, int off, int len) throws IOException Overrides java. Reads up to
The
|
transferTo | back to summary |
---|---|
public long transferTo(OutputStream out) throws IOException Overrides java. Doc from java. Reads all bytes from this input stream and writes the bytes to the given output stream in the order that they are read. On return, this input stream will be at end of stream. This method does not close either stream. This method may block indefinitely reading from the input stream, or writing to the output stream. The behavior for the case where the input and/or output stream is asynchronously closed, or the thread interrupted during the transfer, is highly input and output stream specific, and therefore not specified.
If the total number of bytes transferred is greater than Long#MAX_VALUE, then If an I/O error occurs reading from the input stream or writing to the output stream, then it may do so after some bytes have been read or written. Consequently the input stream may not be at end of stream and one, or both, streams may be in an inconsistent state. It is strongly recommended that both streams be promptly closed if an I/O error occurs.
|