| java.lang.Object java.io.InputStream java.io.SequenceInputStream
SequenceInputStream | public class SequenceInputStream extends InputStream (Code) | | SequenceInputStream is used for streaming over a sequence of streams
concatenated together. Reads are taken from the first stream until it ends,
then the next stream is used until the last stream returns end of file.
|
Method Summary | |
public int | available() Answers a int representing then number of bytes that are available before
this InputStream will block. | public void | close() Close the SequenceInputStream. | public int | read() Reads a single byte from this SequenceInputStream and returns the result
as an int. | public int | read(byte[] buffer, int offset, int count) Reads at most count bytes from this SequenceInputStream
and stores them in byte array buffer starting at
offset . |
SequenceInputStream | public SequenceInputStream(InputStream s1, InputStream s2)(Code) | | Constructs a new SequenceInputStream using the two streams
s1 and s2 as the sequence of streams to
read from.
Parameters: s1 - the first stream to get bytes from Parameters: s2 - the second stream to get bytes from |
SequenceInputStream | public SequenceInputStream(Enumeration<? extends InputStream> e)(Code) | | Constructs a new SequenceInputStream using the elements returned from
Enumeration e as the stream sequence. The types returned
from nextElement() must be of InputStream.
Parameters: e - the Enumeration of InputStreams to get bytes from |
available | public int available() throws IOException(Code) | | Answers a int representing then number of bytes that are available before
this InputStream will block.
the number of bytes available before blocking. throws: IOException - If an error occurs in this InputStream. |
close | public void close() throws IOException(Code) | | Close the SequenceInputStream. All streams in this sequence are closed
before returning from this method. This stream cannot be used for input
once it has been closed.
throws: IOException - If an error occurs attempting to close this FileInputStream. |
read | public int read() throws IOException(Code) | | Reads a single byte from this SequenceInputStream and returns the result
as an int. The low-order byte is returned or -1 of the end of stream was
encountered. The current stream is read from. If it reaches the end of
file, the next stream is read from.
the byte read or -1 if end of stream. throws: IOException - If an error occurs while reading the stream |
read | public int read(byte[] buffer, int offset, int count) throws IOException(Code) | | Reads at most count bytes from this SequenceInputStream
and stores them in byte array buffer starting at
offset . Answer the number of bytes actually read or -1 if
no bytes were read and end of stream was encountered.
Parameters: buffer - the byte array in which to store the read bytes. Parameters: offset - the offset in buffer to store the read bytes. Parameters: count - the maximum number of bytes to store in buffer . the number of bytes actually read or -1 if end of stream. throws: IOException - If an error occurs while reading the stream |
|
|