当前位置:天才代写 > tutorial > JAVA 教程 > java的InputStream的范例

java的InputStream的范例

2017-11-13 08:00 星期一 所属: JAVA 教程 浏览:819

InputStream的浸染是符号那些从差异发源地发生输入的类。这些发源地包罗(每个都有一个相关的InputStream子类):
(1) 字节数组
(2) String工具
(3) 文件
(4) “管道”,它的事情道理与现实糊口中的管道雷同:将一些对象置入一端,它们在另一端出来。 (5) 一系列其他流,以便我们将其统一收集到单唯一个流内。
(6) 其他发源地,如Internet毗连等(将在本书后头的部门报告)。

除此以外,FilterInputStream也属于InputStream的一种范例,用它可为“粉碎器”类提供一个基本类,以便将属性可能有用的接口同输入流毗连到一起。这将在今后接头。

Class
 

Function
 

Constructor Arguments
 

How to use it
 

ByteArray-InputStream
 

Allows a buffer in memory to be used as an InputStream.
 

The buffer from which to extract the bytes.
 

As a source of data. Connect it to a FilterInputStream object to provide a useful interface.
 

StringBuffer-InputStream
 

Converts a String into an InputStream.
 

A String. The underlying implementation actually uses a StringBuffer.
 

As a source of data. Connect it to a FilterInputStream object to provide a useful interface.
 

File-InputStream
 

For reading information from a file.
 

A String representing the file name, or a File or FileDescriptor object.
 

As a source of data. Connect it to a FilterInputStream object to provide a useful interface.
 

类 成果 构建器参数/如何利用

ByteArrayInputStream 答允内存中的一个缓冲区作为InputStream利用 从中提取字节的缓冲区/作为一个数据源利用。通过将其同一个FilterInputStream工具毗连,可提供一个有用的接口
StringBufferInputStream 将一个String转换成InputStream 一个String(字串)。基本的实施方案实际回收一个StringBuffer(字串缓冲)/作为一个数据源利用。通过将其同一个FilterInputStream工具毗连,可提供一个有用的接口
FileInputStream 用于从文件读取信息 代表文件名的一个String,可能一个File或FileDescriptor工具/作为一个数据源利用。通过将其同一个FilterInputStream工具毗连,可提供一个有用的接口

Piped-InputStream
 

Produces the data that’s being written to the associated PipedOutput-Stream. Implements the “piping” concept.
 

PipedOutputStream
 

As a source of data in multithreading. Connect it to a FilterInputStream object to provide a useful interface.
 

Sequence-InputStream
 

Coverts two or more InputStream objects into a single InputStream.
 

Two InputStream objects or an Enumeration for a container of InputStream objects.
 

#p#分页标题#e#

As a source of data. Connect it to a FilterInputStream object to provide a useful interface.
 

Filter-InputStream
 

Abstract class which is an interface for decorators that provide useful functionality to the other InputStream classes. See Table 10-3.
 

See Table 10-3.
 

See Table 10-3.
 

PipedInputString 发生为相关的PipedOutputStream写的数据。实现了“管道化”的观念 PipedOutputStream/作为一个数据源利用。通过将其同一个FilterInputStream工具毗连,可提供一个有用的接口
SequenceInputStream 将两个或更多的InputStream工具转换成单个InputStream利用 两个InputStream工具可能一个Enumeration,用于InputStream工具的一个容器/作为一个数据源利用。通过将其同一个FilterInputStream工具毗连,可提供一个有用的接口
FilterInputStream 对作为粉碎器接口利用的类举办抽象;谁人粉碎器为其他InputStream类提供了有用的成果。拜见表10.3

 

    关键字:

天才代写-代写联系方式