The Sequenceinputstream class allows you to connect multiple InputStream objects. The construction of the Sequenceinputstream object is different from all other InputStream objects. The Sequenceinputstream constructor uses a pair of InputStream objects or a enumeration object of the InputStream object as parameters:
Sequenceinputstream (InputStream first,inputstream second) Sequenceinputstream (enumeration <? extends InputStream > Streamenum)
On the operation, the class reads from the 1th InputStream object until the entire content is read, and then switches to the 2nd InputStream object. For cases where the enumeration object is used, the class continues to read the contents of all InputStream objects until the end of the last InputStream object is reached. When the end of each file is reached, the stream associated with it is closed. Closing a stream created through Sequenceinputstream causes all non-closed streams to be closed.
Let's take a look at the following example one:
Explore Java IO's Sequenceinputstream class