📄 chap11.htm
字号:
and they come out the other.</FONT><BR></P></DIV>
<OL>
<LI><FONT FACE="Verdana"> </FONT><FONT FACE="Georgia">A sequence of other
streams, so you can collect them together into a single
stream.</FONT><LI><FONT FACE="Verdana"> </FONT><FONT FACE="Georgia">Other
sources, such as an Internet connection. (This will be discussed in a later
chapter.)
</backtalk:display>
[ <a href='http://www.mindview.net/backtalk/CommentServlet?ID=TIJ3_CHAPTER11_I21'
target="_blank">Add Comment</a> ]
<backtalk:display ID=TIJ3_CHAPTER11_I22>
</FONT></OL><DIV ALIGN="LEFT"><P><FONT FACE="Georgia">Each
of these has an associated subclass of <B>InputStream</B>. In addition, the
<B>FilterInputStream</B> is also a type of <B>InputStream</B>, to provide a base
class for "decorator" classes that attach attributes or useful interfaces to
input streams. This is discussed later.
</backtalk:display>
[ <a href='http://www.mindview.net/backtalk/CommentServlet?ID=TIJ3_CHAPTER11_I22'
target="_blank">Add Comment</a> ]
<backtalk:display ID=TIJ3_CHAPTER11_I23>
</FONT><BR></P></DIV>
<DIV ALIGN="LEFT"><P><FONT FACE="Georgia"><B>Table 11-1. Types of
InputStream<A NAME="Index1173"></A><A NAME="Index1174"></A><A NAME="Index1175"></A><A NAME="Index1176"></A><A NAME="Index1177"></A><A NAME="Index1178"></A><A NAME="Index1179"></A><A NAME="Index1180"></A><A NAME="Index1181"></A><A NAME="Index1182"></A><A NAME="Index1183"></A><A NAME="Index1184"></A><A NAME="Index1185"></A><A NAME="Index1186"></A><A NAME="Index1187"></A><A NAME="Index1188"></A><A NAME="Index1189"></A><A NAME="Index1190"></A><A NAME="Index1191"></A><A NAME="Index1192"></A></B></FONT><BR></P></DIV>
<DIV ALIGN="CENTER"><TABLE BORDER>
<TR VALIGN="TOP">
<TH WIDTH=99 COLSPAN=1 ROWSPAN=1 VALIGN="TOP">
<DIV ALIGN="LEFT"><P><FONT FACE="Georgia"><B>Class</B></FONT><BR></P></DIV>
</TH>
<TH WIDTH=108 COLSPAN=1 ROWSPAN=1 VALIGN="TOP">
<DIV ALIGN="LEFT"><P><FONT FACE="Georgia"><B>Function</B></FONT><BR></P></DIV>
</TH>
<TH WIDTH=153 COLSPAN=1 ROWSPAN=1 VALIGN="TOP">
<DIV ALIGN="LEFT"><P><FONT FACE="Georgia"><B>Constructor
Arguments</B></FONT><BR></P></DIV>
</TH>
</TR>
<TR VALIGN="TOP">
<TH WIDTH=153 COLSPAN=1 ROWSPAN=1 VALIGN="TOP">
<DIV ALIGN="LEFT"><P><FONT FACE="Georgia"><B>How to use it</B></FONT><BR></P></DIV>
</TH>
</TR>
<TR VALIGN="TOP">
<TD>
<DIV ALIGN="LEFT"><P><FONT FACE="Georgia"><B>ByteArray-InputStream</B></FONT><BR></P></DIV>
</TD>
<TD>
<DIV ALIGN="LEFT"><P><FONT FACE="Georgia">Allows a buffer in memory to be used as
an <B>InputStream</B></FONT><BR></P></DIV>
</TD>
<TD>
<DIV ALIGN="LEFT"><P><FONT FACE="Georgia">The buffer from which to extract the
bytes.</FONT><BR></P></DIV>
</TD>
</TR>
<TR VALIGN="TOP">
<TD>
<DIV ALIGN="LEFT"><P><FONT FACE="Georgia">As a source of data. Connect it to a
<B>FilterInputStream</B> object to provide a useful interface.</FONT><BR></P></DIV>
</TD>
</TR>
<TR VALIGN="TOP">
<TD>
<DIV ALIGN="LEFT"><P><FONT FACE="Georgia"><B>StringBuffer-InputStream</B></FONT><BR></P></DIV>
</TD>
<TD>
<DIV ALIGN="LEFT"><P><FONT FACE="Georgia">Converts a <B>String</B> into an
<B>InputStream</B></FONT><BR></P></DIV>
</TD>
<TD>
<DIV ALIGN="LEFT"><P><FONT FACE="Georgia">A <B>String</B>. The underlying
implementation actually uses a <B>StringBuffer</B>.</FONT><BR></P></DIV>
</TD>
</TR>
<TR VALIGN="TOP">
<TD>
<DIV ALIGN="LEFT"><P><FONT FACE="Georgia">As a source of data. Connect it to a
<B>FilterInputStream</B> object to provide a useful interface.</FONT><BR></P></DIV>
</TD>
</TR>
<TR VALIGN="TOP">
<TD>
<DIV ALIGN="LEFT"><P><FONT FACE="Georgia"><B>File-InputStream</B></FONT><BR></P></DIV>
</TD>
<TD>
<DIV ALIGN="LEFT"><P><FONT FACE="Georgia">For reading information from a
file</FONT><BR></P></DIV>
</TD>
<TD>
<DIV ALIGN="LEFT"><P><FONT FACE="Georgia">A <B>String</B> representing the file
name, or a <B>File</B> or <B>FileDescriptor</B> object.</FONT><BR></P></DIV>
</TD>
</TR>
<TR VALIGN="TOP">
<TD>
<DIV ALIGN="LEFT"><P><FONT FACE="Georgia">As a source of data. Connect it to a
<B>FilterInputStream</B> object to provide a useful interface.</FONT><BR></P></DIV>
</TD>
</TR>
<TR VALIGN="TOP">
<TD>
<DIV ALIGN="LEFT"><P><FONT FACE="Georgia"><B>Piped-InputStream</B></FONT><BR></P></DIV>
</TD>
<TD>
<DIV ALIGN="LEFT"><P><FONT FACE="Georgia">Produces the data that’s being
written to the associated <B>PipedOutput</B>-<B>Stream</B>. Implements the
“piping” concept.</FONT><BR></P></DIV>
</TD>
<TD>
<DIV ALIGN="LEFT"><P><FONT FACE="Georgia"><B>PipedOutputStream</B></FONT><BR></P></DIV>
</TD>
</TR>
<TR VALIGN="TOP">
<TD>
<DIV ALIGN="LEFT"><P><FONT FACE="Georgia">As a source of data in multithreading.
Connect it to a <B>FilterInputStream</B> object to provide a useful
interface.</FONT><BR></P></DIV>
</TD>
</TR>
<TR VALIGN="TOP">
<TD>
<DIV ALIGN="LEFT"><P><FONT FACE="Georgia"><B>Sequence-InputStream</B></FONT><BR></P></DIV>
</TD>
<TD>
<DIV ALIGN="LEFT"><P><FONT FACE="Georgia">Converts two or more <B>InputStream</B>
objects into a single <B>InputStream</B>.</FONT><BR></P></DIV>
</TD>
<TD>
<DIV ALIGN="LEFT"><P><FONT FACE="Georgia">Two <B>InputStream</B> objects or an
<B>Enumeration</B> for a container of <B>InputStream</B>
objects.</FONT><BR></P></DIV>
</TD>
</TR>
<TR VALIGN="TOP">
<TD>
<DIV ALIGN="LEFT"><P><FONT FACE="Georgia">As a source of data. Connect it to a
<B>FilterInputStream</B> object to provide a useful interface.</FONT><BR></P></DIV>
</TD>
</TR>
<TR VALIGN="TOP">
<TD>
<DIV ALIGN="LEFT"><P><FONT FACE="Georgia"><B>Filter-InputStream</B></FONT><BR></P></DIV>
</TD>
<TD>
<DIV ALIGN="LEFT"><P><FONT FACE="Georgia">Abstract class which is an interface for
decorators that provide useful functionality to the other <B>InputStream</B>
classes. See Table 11-3.</FONT><BR></P></DIV>
</TD>
<TD>
<DIV ALIGN="LEFT"><P><FONT FACE="Georgia">See Table 11-3.</FONT><BR></P></DIV>
</TD>
</TR>
<TR VALIGN="TOP">
<TD>
<DIV ALIGN="LEFT"><P><FONT FACE="Georgia">See Table 11-3.</FONT><BR></P></DIV>
</TD>
</TR>
<A NAME="_Toc375545385"></A><A NAME="_Toc481064740"></A></TABLE></P></DIV>
<A NAME="Heading360"></A><FONT FACE = "Verdana"><H3 ALIGN="LEFT">
Types of OutputStream<BR><A NAME="Index1193"></A><A NAME="Index1194"></A></H3></FONT>
<DIV ALIGN="LEFT"><P><FONT FACE="Georgia">This category includes the classes that
decide where your output will go: an array of bytes (no <B>String</B>, however;
presumably you can create one using the array of bytes), a file, or a
“pipe.”
</backtalk:display>
[ <a href='http://www.mindview.net/backtalk/CommentServlet?ID=TIJ3_CHAPTER11_I23'
target="_blank">Add Comment</a> ]
<backtalk:display ID=TIJ3_CHAPTER11_I24>
</FONT><BR></P></DIV>
<DIV ALIGN="LEFT"><P><FONT FACE="Georgia">In addition, the
<B>FilterOutputStream</B> provides a base class for "decorator" classes that
attach attributes or useful interfaces to output streams. This is discussed
later.
</backtalk:display>
[ <a href='http://www.mindview.net/backtalk/CommentServlet?ID=TIJ3_CHAPTER11_I24'
target="_blank">Add Comment</a> ]
<backtalk:display ID=TIJ3_CHAPTER11_I25>
</FONT><BR></P></DIV>
<DIV ALIGN="LEFT"><P><FONT FACE="Georgia"><B>Table 11-2. Types of
OutputStream<A NAME="Index1195"></A><A NAME="Index1196"></A><A NAME="Index1197"></A><A NAME="Index1198"></A><A NAME="Index1199"></A><A NAME="Index1200"></A><A NAME="Index1201"></A><A NAME="Index1202"></A></B></FONT><BR></P></DIV>
<DIV ALIGN="CENTER"><TABLE BORDER>
<TR VALIGN="TOP">
<TH WIDTH=99 COLSPAN=1 ROWSPAN=1 VALIGN="TOP">
<DIV ALIGN="LEFT"><P><FONT FACE="Georgia"><B>Class</B></FONT><BR></P></DIV>
</TH>
<TH WIDTH=117 COLSPAN=1 ROWSPAN=1 VALIGN="TOP">
<DIV ALIGN="LEFT"><P><FONT FACE="Georgia"><B>Function</B></FONT><BR></P></DIV>
</TH>
<TH WIDTH=153 COLSPAN=1 ROWSPAN=1 VALIGN="TOP">
<DIV ALIGN="LEFT"><P><FONT FACE="Georgia"><B>Constructor
Arguments</B></FONT><BR></P></DIV>
</TH>
</TR>
<TR VALIGN="TOP">
<TH WIDTH=153 COLSPAN=1 ROWSPAN=1 VALIGN="TOP">
<DIV ALIGN="LEFT"><P><FONT FACE="Georgia"><B>How to use it</B></FONT><BR></P></DIV>
</TH>
</TR>
<TR VALIGN="TOP">
<TD>
<DIV ALIGN="LEFT"><P><FONT FACE="Georgia"><B>ByteArray-OutputStream</B></FONT><BR></P></DIV>
</TD>
<TD>
<DIV ALIGN="LEFT"><P><FONT FACE="Georgia">Creates a buffer in memory. All the data
that you send to the stream is placed in this buffer.</FONT><BR></P></DIV>
</TD>
<TD>
<DIV ALIGN="LEFT"><P><FONT FACE="Georgia">Optional initial size of the
buffer.</FONT><BR></P></DIV>
</TD>
</TR>
<TR VALIGN="TOP">
<TD>
<DIV ALIGN="LEFT"><P><FONT FACE="Georgia">To designate the destination of your
data. Connect it to a <B>FilterOutputStream</B> object to provide a useful
interface.</FONT><BR></P></DIV>
</TD>
</TR>
<TR VALIGN="TOP">
<TD>
<DIV ALIGN="LEFT"><P><FONT FACE="Georgia"><B>File-OutputStream</B></FONT><BR></P></DIV>
</TD>
<TD>
<DIV ALIGN="LEFT"><P><FONT FACE="Georgia">For sending information to a
file.</FONT><BR></P></DIV>
</TD>
<TD>
<DIV ALIGN="LEFT"><P><FONT FACE="Georgia">A String representing the file name, or a
<B>File</B> or <B>FileDescriptor</B> object.</FONT><BR></P></DIV>
</TD>
</TR>
<TR VALIGN="TOP">
<TD>
<DIV ALIGN="LEFT"><P><FONT FACE="Georgia">To designate the destination of your
data. Connect it to a <B>FilterOutputStream</B> object to provide a useful
interface.</FONT><BR></P></DIV>
</TD>
</TR>
<TR VALIGN="TOP">
<TD>
<DIV ALIGN="LEFT"><P><FONT FACE="Georgia"><B>Piped-OutputStream</B></FONT><BR></P></DIV>
</TD>
<TD>
<DIV ALIGN="LEFT"><P><FONT FACE="Georgia">Any information you write to this
automatically ends up as input for the associated <B>PipedInput-Stream</B>.
Implements the “piping” concept.</FONT><BR></P></DIV>
</TD>
<TD>
<DIV ALIGN="LEFT"><P><FONT FACE="Georgia"><B>PipedInputStream</B></FONT><BR></P></DIV>
</TD>
</TR>
<TR VALIGN="TOP">
<TD>
<DIV ALIGN="LEFT"><P><FONT FACE="Georgia">To designate the destination of your data
for multithreading. Connect it to a <B>FilterOutputStream</B> object to provide
a useful interface.</FONT><BR></P></DIV>
</TD>
</TR>
<TR VALIGN="TOP">
<TD>
<DIV ALIGN="LEFT"><P><FONT FACE="Georgia"><B>Filter-OutputStream</B></FONT><BR></P></DIV>
</TD>
<TD>
<DIV ALIGN="LEFT"><P><FONT FACE="Georgia">Abstract class which is an interface for
decorators that provide useful functionality to the other <B>OutputStream</B>
classes. See Table 11-4.</FONT><BR></P></DIV>
</TD>
<TD>
<DIV ALIGN="LEFT"><P><FONT FACE="Georgia">See Table 11-4.</FONT><BR></P></DIV>
</TD>
</TR>
<TR VALIGN="TOP">
<TD>
<DIV ALIGN="LEFT"><P><FONT FACE="Georgia">See Table 11-4.</FONT><BR></P></DIV>
</TD>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -