Skip to content
Navigation Menu
Sign in
Appearance settings
Platform
AI CODE CREATION
GitHub Copilot
Write better code with AI
GitHub Copilot app
Direct agents from issue to merge
MCP Registry
Integrate external tools
DEVELOPER WORKFLOWS
Actions
Automate any workflow
Codespaces
Instant dev environments
Issues
Plan and track work
Code Review
Manage code changes
Code Quality
Enforce quality at merge
APPLICATION SECURITY
GitHub Advanced Security
Find and fix vulnerabilities
Code security
Secure your code as you build
Secret protection
Stop leaks before they start
EXPLORE
Why GitHub
Documentation
Blog
Changelog
Marketplace
View all features
Solutions
BY COMPANY SIZE
Enterprises
Small and medium teams
Startups
Nonprofits
BY USE CASE
App Modernization
DevSecOps
DevOps
CI/CD
View all use cases
BY INDUSTRY
Healthcare
Financial services
Manufacturing
Government
View all industries
View all solutions
Resources
EXPLORE BY TOPIC
AI
Software Development
DevOps
Security
View all topics
EXPLORE BY TYPE
Customer stories
Events & webinars
Ebooks & reports
Business insights
GitHub Skills
SUPPORT & SERVICES
Documentation
Customer support
Community forum
Trust center
Partners
View all resources
Open Source
COMMUNITY
GitHub Sponsors
Fund open source developers
PROGRAMS
Security Lab
Maintainer Community
GitHub Stars
Archive Program
REPOSITORIES
Topics
Trending
Collections
Enterprise
ENTERPRISE SOLUTIONS
Enterprise platform
AI-powered developer platform
AVAILABLE ADD-ONS
GitHub Advanced Security
Enterprise-grade security features
Copilot for Business
Enterprise-grade AI features
Premium Support
Enterprise-grade 24/7 support
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.