java.io
Class SequenceInputStream

java.lang.Object
  |
  +--java.io.InputStream
        |
        +--java.io.SequenceInputStream

public class SequenceInputStream
extends InputStream

Converts a sequence of input streams into an InputStream.


Constructor Summary
SequenceInputStream(Enumeration e)
          Constructs a new SequenceInputStream initialized to the specified list.
SequenceInputStream(InputStream s1, InputStream s2)
          Constructs a new SequenceInputStream initialized to the two specified input streams.
 
Method Summary
 void close()
          Closes the input stream; flipping to the next stream, if an EOF is reached.
 int read()
          Reads a stream, and upon reaching an EOF, flips to the next stream.
 int read(byte[] buf, int pos, int len)
          Reads data into an array of bytes, and upon reaching an EOF, flips to the next stream.
 
Methods inherited from class java.io.InputStream
available, mark, markSupported, read, reset, skip
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SequenceInputStream

public SequenceInputStream(Enumeration e)
Constructs a new SequenceInputStream initialized to the specified list.

Parameters:
e - the list

SequenceInputStream

public SequenceInputStream(InputStream s1,
                           InputStream s2)
Constructs a new SequenceInputStream initialized to the two specified input streams.

Parameters:
s1 - the first input stream
s2 - the second input stream
Method Detail

read

public int read()
         throws IOException
Reads a stream, and upon reaching an EOF, flips to the next stream.

Specified by:
read in class InputStream
Returns:
the byte read, or -1 if the end of the stream is reached.
Throws:
IOException - If an I/O error has occurred.

read

public int read(byte[] buf,
                int pos,
                int len)
         throws IOException
Reads data into an array of bytes, and upon reaching an EOF, flips to the next stream.

Overrides:
read in class InputStream
Parameters:
buf - the buffer into which the data is read
pos - the start position of the data
len - the maximum number of bytes read
Returns:
the actual number of bytes read, -1 is returned when the end of the stream is reached.
Throws:
IOException - If an I/O error has occurred.

close

public void close()
           throws IOException
Closes the input stream; flipping to the next stream, if an EOF is reached. This method must be called to release any resources associated with the stream.

Overrides:
close in class InputStream
Throws:
IOException - If an I/O error has occurred.