java.io.SequenceInputStream
java.io.InputStream
None
None
JDK 1.0 or later
The SequenceInputStream class allows a series of InputStream objects to be seamlessly concatenated into one stream. In other words, a SequenceInputStream appears and functions as a single InputStream. Internally, however, the SequenceInputStream reads data from each InputStream in the specified order. When the end of a stream is encountered, data is automatically read from the next stream.
public class java.io.SequenceInputStream extends java.io.InputStream { // Constructors public SequenceInputStream(Enumeration e); public SequenceInputStream(InputStream s1, InputStream s2); // Instance Methods public int available(); // New in 1.1 public void close(); public int read(); public int read(byte[] buf, int pos, int len); }
An Enumeration of input streams.
This constructor creates a SequenceInputStream that reads from each of the InputStream objects in the given Enumeration. Each object in the Enumeration must be an InputStream.
An input stream.
Another input stream.
This constructor creates a SequenceInputStream that reads first from s1 and then from s2.
New as of JDK 1.1
The number of bytes that can be read without blocking, or 0 if the end of the final stream is encountered.
If any kind of I/O error occurs.
InputStream.available()
This method returns the number of bytes that can be read without having to wait for more data to become available. The method returns the result of calling available() on the current stream. If the end of the final stream is encountered, the method returns 0.
If any kind of I/O error occurs.
InputStream.close()
This method closes the stream and releases the system resources that are associated with it. The method closes all the InputStream objects attached to this object.
The next byte of data or -1 if the end of the final stream is encountered.
If any kind of I/O error occurs.
InputStream.read()
This method reads the next byte of data from the current stream. When the end of the current stream is encountered, that stream is closed, and the first byte of the next InputStream is read. If there are no more InputStream objects in the SequenceInputStream, -1 is returned to signify the end of the SequenceInputStream. The method blocks until the byte is read, the end of the final stream is encountered, or an exception is thrown.
An array of bytes to be filled from the stream.
An offset into the byte array.
The number of bytes to read.
The actual number of bytes read or -1 if the end of the final stream is encountered immediately.
If any kind of I/O error occurs.
InputStream.read(byte[], int, int)
This method reads up to len bytes of input from the current stream into the given array starting at index off. When the end of the current stream is encountered, that stream is closed, and bytes are read from the next InputStream. If there are no more InputStream objects in the SequenceInputStream, -1 is returned to signify the end of the SequenceInputStream. The method blocks until there is some data available.
Method |
Inherited From |
Method |
Inherited From |
---|---|---|---|
clone() |
Object |
equals(Object) |
Object |
finalize() |
Object |
getClass() |
Object |
hashCode() |
Object |
mark(int) |
InputStream |
markSupported() |
InputStream |
notify() |
Object |
notifyAll() |
Object |
reset() |
InputStream |
skip(long) |
InputStream |
toString() |
Object |
wait() |
Object |
wait(long) |
Object |
wait(long, int) |
Object |
InputStream, IOException
This HTML Help has been published using the chm2web software. |