IO-STEAM-基础

定义

先来看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. 等

输入流
这里写图片描述

输出流
这里写图片描述

JAVA中Stream类的设计

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

JAVA-SE中类的设计是,先根据 【数据种类】写一个父类,比如 InputStream。然后根据【目标资源】的不同写一个具体的实现类,比如 FileInputStream 实现对文件的字节读写。

评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值