您的位置:首页 > 其它

IO-STEAM-基础

2015-08-13 14:01 232 查看

定义

先来看java中对于IO中STREAM的定义

An I/O Stream represents an input source or an output destination. A stream can represent many different kinds of sources and destinations, including disk files, devices, other programs, and memory arrays.

Stream 是建立在物理资源上的,input source or output destination.

Streams support many different kinds of data, including simple bytes, primitive data types, localized characters, and objects. Some streams simply pass on data; others manipulate and transform the data in useful ways.

Stream 支持不同数据种类。BYTE, CHARACTER, PRIMITIVE DATA TYPES, OBJECTS. 等

输入流



输出流



J***A中Stream类的设计

所以Stream有两个属性,【目标资源】和【数据种类】,根据这两个属性可以对J***A-SE中STREAM分类。

J***A-SE中类的设计是,先根据 【数据种类】写一个父类,比如 InputStream。然后根据【目标资源】的不同写一个具体的实现类,比如 FileInputStream 实现对文件的字节读写。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: