java.io.SequenceInputStream
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.
Summary
Public Constructors
Public Methods
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait
Details
Public Constructors
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 |
s2
| the second stream to get bytes from
|
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
|
Public Methods
public
int
available()
Returns a int representing then number of bytes that are available before
this InputStream will block.
Returns
- the number of bytes available before blocking.
public
void
close()
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.
|
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
. 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. |
offset
| the offset in buffer to store the read bytes. |
count
| the maximum number of bytes to store in buffer . |
Returns
- the number of bytes actually read or -1 if end of stream.
Throws
IOException
| If an error occurs while reading the stream
|
public
int
read()
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.
Returns
- the byte read or -1 if end of stream.
Throws
IOException
| If an error occurs while reading the stream
|