Skip to content
Navigation Menu
Sign in
Products
Platform
GitHub
Repository hosting, code review, and collaboration
Copilot
AI coding agent for tasks, projects, and automated work
Build & Ship
Actions
CI/CD and automation
Code Quality
Quality analysis, fixes, and enforcement
Codespaces
Cloud development environments
Secure
Code Security
Vulnerability detection and remediation
Secret Protection
Secret scanning and leak prevention
All Features
Developers
Learn
Documentation
Training
Certifications
Build
Build with Copilot
Customize Copilot
Integrations
Explore
Trending repos
GitHub Sponsors
Developer articles
Changelog
Changelog
Your source for the latest features, improvements, and fixes across GitHub products, all in one place.
Businesses
By Stage
Enterprises
Team
Startups
Nonprofits
By Industry
Healthcare
Financial services
Manufacturing
Government
See all industries
Evaluate GitHub
Why GitHub
Customer Stories
Business insights
Trust Center
Add-ons
GitHub Advanced Security
Enterprise-grade code security
Copilot for business
Enterprise-grade AI features
Premium Support
Enterprise-grade 24/7 support
Resources
Learn & Connect
Documentation
Resource center
Blog
Events & webinars
Community Forum
Customer Stories
Integrations
Support
Customer support
Training
GitHub Status
Company
About
Partners
Changelog
GitHub Universe
GitHub Universe
The event for developers, by developers — talks, workshops, and what’s next for GitHub.
Pricing
Search
/
Sign in
Sign up
Appearance settings
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
JavaDevelopRep
Java
Repository navigation
Code
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
More
items
Files
Expand file tree
master
Breadcrumbs
Java
/
day22
/
day22.txt
Copy path
Blame
More file actions
Blame
More file actions
Latest commit
History
History
History
52 lines (40 loc) · 1.36 KB
master
Breadcrumbs
Java
/
day22
/
day22.txt
Copy path
Top
File metadata and controls
Code
Blame
52 lines (40 loc) · 1.36 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
1:面试题
(1)用Reader模拟BufferedReader的readLine()方法
(2)用Reader和BufferedReader模拟readNumberLine()方法
(3)继承改第二题
2:基本数据操作流
DataInputStream/DataOutputStream:能够操作所有的基本类型,注意读写顺序保持一致
3:内存操作流(数组操作流)
数据不做永久储存
ByteArrayInputStream/ByteArrayOutputStream:字节数组操作流
CharArrayReader/CharArrayWriter:字符数组操作流
StringReader/StringWriter:字符串操作流
4:打印流
PrintWriter/PrintStream:
特点:只能操作目的地,不能操作数据源
可以操作任意类型的数据
如果启用了自动刷新,可以自动刷新:开启自动刷新,与println配合使用,一句顶过 去三句
可以直接操作文件:
构造方法可以同时接收File和String类型的都可以直接操作文件
printf的使用:String format % 格式化输出
5:标准输入输出流
System.in:BufferedReader br = new BufferedReader(new InputStream(System.in));
System.out:BufferedWriter bw = new BufferedWriter(new OutputStream(System.out));
后面参数不具有具体文件路径无需释放资源
6:随机存取
RandomAccessFile:
seek()方法
7:合并流
SequenceInputStream:
构造方法:
接收两个InputStream 参数
接收多个InputStream参数:
8:序列化流
序列化:为了让对象数据永久储存或者实现在网络中传输而生成的二进制流
反序列化:将序列化对象还原
如何序列化:实现Seriable接口
没有任何方法接口的意义:标记接口
解决小问题:只要有一点小小的变动,会重新产生一个序列化id值
指定一个固定的SerialVersionUID
9:Properties集合:
10:nio
You can’t perform that action at this time.