📄 javaio.doc6.html
字号:
<html>
<head>
<title>The Java Language Specification The Package java.io </title>
</head>
<body BGCOLOR=#eeeeff text=#000000 LINK=#0000ff VLINK=#000077 ALINK=#ff0000>
<a href="index.html">Contents</a> | <a href="javaio.doc5.html">Prev</a> | <a href="javaio.doc7.html">Next</a> | <a href="j.index.doc1.html">Index</a>
<hr><br>
<a name="28491"></a>
<center><h1>22.8 The Class <code>java.io.SequenceInputStream</code></h1></center>
<a name="28492"></a>
A <code>SequenceInputStream</code> represents the logical concatenation of other input
streams. It starts out with an ordered collection of input streams and reads from
the first one until end of file is reached, whereupon it reads from the second one,
and so on, until end of file is reached on the last of the contained input streams.
<p><pre><a name="28493"></a>public class <code><b>SequenceInputStream</b></code> extends InputStream {
<a name="28494"></a> public <code><b>SequenceInputStream</b></code>(Enumeration e);
<a name="28495"></a> public <code><b>SequenceInputStream</b></code>(InputStream s1, InputStream s2);
<a name="28496"></a> public int <code><b>read</b></code>() throws IOException;
<a name="28498"></a> public int <code><b>read</b></code>(byte[] buf, int pos, int len)
<a name="28499"></a> throws IOException, NullPointerException,
<a name="32327"></a> IndexOutOfBoundsException;
<a name="28500"></a> public void <code><b>close</b></code>() throws IOException;
<a name="28501"></a>}
</pre><a name="28502"></a>
<p><font size=+1><strong>22.8.1 </strong> <code>public <code><b>SequenceInputStream</b></code>(Enumeration e)</code></font>
<p>
<a name="28503"></a>
This constructor initializes a newly created <code>SequenceInputStream</code> by remembering
the argument, which must be an <code>Enumeration</code> <a href="javautil.doc.html#23147">(§21.1)</a> that produces
objects whose run-time type is <code>InputStream</code> <a href="javaio.doc1.html#28126">(§22.3)</a>. The input streams that are
produced by the enumeration will be read, in order, to provide the bytes to be read
from this <code>SequenceInputStream</code>. After each input stream from the enumeration
is exhausted, it is closed by calling its <code>close</code> method.
<p><a name="28510"></a>
<p><font size=+1><strong>22.8.2 </strong> <code>public <code><b>SequenceInputStream</b></code>(InputStream s1,<br>      InputStream s2)</code></font>
<p>
<a name="28511"></a>
This constructor initializes a newly created <code>SequenceInputStream</code> by remembering
the two arguments, which will be read in order, first <code>s1</code> and then <code>s2</code>, to provide
the bytes to be read from this <code>SequenceInputStream</code>.
<p><a name="28512"></a>
<p><font size=+1><strong>22.8.3 </strong> <code>public int <code><b>read</b></code>() throws IOException</code></font>
<p>
<a name="28516"></a>
Implements the <code>read</code> method of <code>InputStream</code> <a href="javaio.doc1.html#28142">(§22.3.1)</a>.
<p><a name="28517"></a>
<p><font size=+1><strong>22.8.4 </strong> <code>public int <code><b>read</b></code>(byte[] buf, int pos, int len)<br>throws IOException, NullPointerException,      IndexOutOfBoundsException</code></font>
<p>
<a name="28521"></a>
Overrides the <code>read</code> method of <code>InputStream</code> <a href="javaio.doc1.html#28164">(§22.3.3)</a>.
<p><a name="28522"></a>
<p><font size=+1><strong>22.8.5 </strong> <code>public void <code><b>close</b></code>() throws IOException</code></font>
<p>
<a name="28523"></a>
This <code>SequenceInputStream</code> is closed. A closed <code>SequenceInputStream</code> cannot
perform input operations and cannot be reopened.
<p><a name="28524"></a>
If this stream was created from an enumeration, all remaining elements are requested from the enumeration and closed before the <code>close</code> method returns.<p>
<a name="28528"></a>
Overrides the <code>close</code> method of <code>InputStream</code> <a href="javaio.doc1.html#28187">(§22.3.6)</a>.<p>
<hr>
<!-- This inserts footnotes--><p>
<a href="index.html">Contents</a> | <a href="javaio.doc5.html">Prev</a> | <a href="javaio.doc7.html">Next</a> | <a href="j.index.doc1.html">Index</a>
<p>
<font size=-1>Java Language Specification (HTML generated by Suzette Pelouch on February 24, 1998)<br>
<i><a href="jcopyright.doc.html">Copyright © 1996 Sun Microsystems, Inc.</a>
All rights reserved</i>
<br>
Please send any comments or corrections to <a href="mailto:doug.kramer@sun.com">doug.kramer@sun.com</a>
</font>
</body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -