当前位置:网站首页>Common problems in io streams
Common problems in io streams
2022-07-03 07:10:00 【L gold p】
1.IO
1.1 summary
Flow is a set of sequential , Set of bytes with start and end points , Is the general term or abstraction of data transmission . That is, the transmission of data between two devices is called streaming , The essence of stream is data transmission , According to the characteristics of data transmission, streams are abstracted into various kinds , Convenient and more intuitive data operation .
I:input Input stream
O:output: Output stream
1.2 classification
According to the type of data processed , It is divided into byte stream and character stream
It is divided into input flow and output flow according to different data flow directions .( In and out are relative to memory )
According to different functions , It is divided into node flow and processing flow
Node flow : Direct manipulation of data sources
Processing flow : Process other streams
1.3 Four abstract classes

1.3.1 InputStream

1.3.2 OutPutStream

1.3.3 Reader

1.3.4 Writer

1.4 File stream
1.4.1 FileInputStream
summary : Used to open the file and read the data in the file
Want to read a file , You must find it first , You must use this file stream
1. Absolute position
The system root directory shall prevail , such as D:/xxx/xxx/xxx/a.txt
2. The relative position
./ Represents the current directory
…/ Indicates the parent directory
…/…/ Go to the superior directory
Common methods

1.4.2 Read Use
read: Read a byte , And return the corresponding ASCLL Code value , Return to int type , If you reach the end of the file ( After reading the ) Then return to -1
read Method overloading : You can pass an array , One read will fill the array / After reading , And then back in one go
return int type , Is the current number of reads , If the end of the file is reached return -1
The array is equivalent to a buffer , It will improve efficiency
1.4.3 FileReader
summary : FileReader: Read one character at a time , That's two bytes , Mainly used to read plain text , Solve the mess
read(): Read one character at a time , Return the corresponding ASCLL code , Return at the end -1
read(char[]): Read one character array at a time , Improve reading efficiency , Returns the number of characters read locally , Return at the end of the file -1
Usage mode
1.5 Buffer flow

characteristic
- It exists mainly to improve efficiency , Reduce the number of physical reads
- Provide readLine()、newLine() Such a convenient way ( For buffered character stream )
- When reading and writing , There will be a cache part , call flush To refresh the cache , Write memory data to disk
5.1 BufferedReader
1.5.2 BufferedWriter

1.6 Converted flow


1.7 Print stream


1.8 Data flow


边栏推荐
- PAT甲级真题1166
- [Fiddler actual operation] how to use Fiddler to capture packets on Apple Mobile Phones
- 2022-06-23 VGMP-OSPF-域间安全策略-NAT策略(更新中)
- Software testing assignment - day 1
- mysql误删root账户导致无法登录
- Sorting out the core ideas of the pyramid principle
- Basic components and intermediate components
- How can I split a string at the first occurrence of “-” (minus sign) into two $vars with PHP?
- Redis command
- Unit test notes
猜你喜欢

Jenkins
![[Fiddler problem] solve the problem about Fiddler's packet capturing. After the mobile network is configured with an agent, it cannot access the Internet](/img/9d/42dfef67246740f0dba0c6d8f1b625.jpg)
[Fiddler problem] solve the problem about Fiddler's packet capturing. After the mobile network is configured with an agent, it cannot access the Internet

熊市里的大机构压力倍增,灰度、Tether、微策略等巨鲸会不会成为'巨雷'?

Recursion, Fibonacci sequence

Discussion on some problems of array

Sorting, dichotomy

Pat grade a real problem 1166
![[HCAI] learning summary OSI model](/img/90/66505b22e32aa00b26886a9d5c5e4c.jpg)
[HCAI] learning summary OSI model

dataworks自定义函数开发环境搭建

La loi des 10 000 heures ne fait pas de vous un maître de programmation, mais au moins un bon point de départ
随机推荐
Realize PDF to picture conversion with C #
mysql误删root账户导致无法登录
The education of a value investor
[most detailed] latest and complete redis interview book (50)
[day15] introduce the features, advantages and disadvantages of promise, and how to implement it internally. Implement promise by hand
Machine learning | simple but feature standardization methods that can improve the effect of the model (comparison and analysis of robustscaler, minmaxscaler, standardscaler)
691. Cube IV
“百度杯”CTF比赛 2017 二月场,Web:爆破-1
2022-06-23 VGMP-OSPF-域間安全策略-NAT策略(更新中)
Tool class static method calls @autowired injected service
深度学习参数初始化(一)Xavier初始化 含代码
Selenium key knowledge explanation
Error c2017: illegal escape sequence
Getting started with pytest
【已解决】SQLException: Invalid value for getInt() - ‘田鹏‘
PHP install composer
Asynchronous programming: async/await in asp Net
Thoughts on project development
dataworks自定义函数开发环境搭建
[set theory] partition (partition | partition example | partition and equivalence relationship)

