当前位置:网站首页>Basic Concepts of IO
Basic Concepts of IO
2022-08-07 01:02:00 【hard work boy】
Division of IO streams
According to the flow direction of the flow, it can be divided into input flow and output flow.
According to the operation unit, it can be divided into byte stream and character stream.
According to the role of the flow, it is divided into node flow and processing flow.
Node Stream: Data can be read and written from or to a specific place (node).Such as FileReader, FileWriter.
Processing stream: It is the connection and encapsulation of an existing stream, and data read and write is realized through the function call of the encapsulated stream.Such as BufferedReader. The constructor that handles streams always takes an additional stream object as a parameter.A stream object is wrapped multiple times by other streams, which is called stream chaining.
Node streams are low-level/low-level streams that connect directly to data sources.A processing stream (wrapper stream) wraps a node stream, which can not only eliminate the implementation differences of different node streams, but also provide a more convenient way to complete input and output.The processing flow wraps the node flow, mainly by increasing the buffering method to improve the efficiency of input and output, using the decorator design pattern, and will not be directly connected to the data source.
Main abstract class
InputStream/Reader: The base class for all input streams, InputStream is a byte input stream, and InputReader is a character input stream.
OutputStream/Writer: The base class for all output streams, OutputStream is a byte output stream, and OutputWriter is a character output stream.
Character IO stream

Byte IO stream

For low load, low concurrency applicationsProgram, you can use synchronous blocking IO or BIO to improve the development rate and better maintainability; for high-load, high-concurrency (network) applications, the synchronous non-blocking I/O model NIO should be used for development.AIO (Asynchronous I/O) is an asynchronous non-blocking IO model. It is implemented based on events and callback mechanisms. After the application operation, it will return directly without blocking. When the background processing is completed, the operating system will notify the corresponding thread to perform subsequent operations.
边栏推荐
猜你喜欢
随机推荐
Ftrace function graph简介
虚拟机CrossOver2022下载及如何使用教程
【华为云至简致远】还在烦恼成本高、运维难?华为云数据库给你一个标准答案!
Vi learning (2) the common commands include move cursor/highlight the text/undo and the undo/delete/copy and paste the text/find replacement/insert 】
自学软件测试看什么书入门比较好呢?
04 多线程与高并发 - ReentrantReadWriteLock 源码解析
Classic backbone model cheat sheet in CV field (2)
电话订货、线下赊账、人工打单,批发生意越做越简单
IO的基本概念
2022.8.4 Mock Competition
实时图计算如何进行风控决策管理?
Multiple Dockets with the same group name are not supported.The following duplicate groups were disc
通达信买股票佣金最低是多少?开户安全吗?
【1408. 数组中的字符串匹配】
Pyhton知识点6——列表
Detailed explanation of C51 basic functions, interrupt functions and library functions
CompletableFuture使用示例
2022年电工(初级)特种作业证考试题库及模拟考试
登顶KITTI!Mix-Teaching:适用于单目3D目标检测的半监督方法【清华大学】
Service是如何启动的?一文告诉你









