当前位置:网站首页>IO流分类整理
IO流分类整理
2022-07-24 03:17:00 【乔宽 青青河边草】
JAVA中的IO流非常多,但我们常用的有几种:

IO流分类
按照“流”的数据流向,可以将其化分为:输入流和输出流。
按照“流”中处理数据的单位,可以将其区分为:字节流和字符流。在java中,字节是占1个Byte,即8位;而字符是占2个Byte,即16位。而且,需要注意的是,java的字节是有符号类型,而字符是无符号类型!
字节流的抽象基类:
InputStream,OutputStream
字符流的抽象基类:
Reader,Writer
由这四个类派生出来的子类名称都是以其父类名作为子类名的后缀,如InputStream的子类FileInputStream,Reader的子类FileReader。
字节缓冲输入流和字节缓冲输出流作用:较少IO次数,提高IO的效率。
字节输入流(InputStream):
常用子类:
FileInputStream
BufferedInputStream:
字节输出流(OutputStream):
常用子类:
FileOutputStream
BufferedOutputStream:
字符输入流(Reader):
常用子类:
FileReader
BufferedReader
字符输出流(Writer):
常用子类:
FileWriter
BufferedWriter
OutputStreamWriter:
构造方法:
//使用默认的字符编码写出数据
public OutputStreamWriter(OutputStream os);
//使用自己指定的字符编码写出数据
public OutputStreamWriter(OutputStream os,String charsetName);
PrintStream:打印流
边栏推荐
- Binary search
- Lagrange polynomial
- Cannot resolve symbol 'override' of idea clone‘
- kettle
- WPS前骨干历时10年打造新型软件,Excel用户:我为此改用WPS
- [C language] file operation
- The function of SIP account - tell you what is SIP line
- Test interview questions
- 水题: 接雨水
- In the future, when the interviewer asks why you don't recommend using select *, please answer him loudly!
猜你喜欢

Xiaodi and Xiaohui

Interviewer: if the order is not paid within 30 minutes after it is generated, it will be automatically cancelled. How to realize it?

Ugui source code analysis - maskutilities

Realize the communication before two pages (using localstorage)

Customize the default width and height of kindeditor rich text

QT custom class uses custom parametric signals and slots

The simple use of ADB command combined with monkey is super detailed

Outlook client outlook.com mailbox setting method

Error code 0x80004005

Lumberyard game engine of o3de
随机推荐
Take you into the world of MySQL mvcc
How to realize software function safety
Hcip day 10 (initial BGP border gateway protocol)
[hdlbits questions] Verilog language (2) vectors
什么是IMU?
Data Lake: introduction to Apache Hudi
uva1445
I developed an app similar to wechat runnable applet with fluent
FTP服務與配置
[AMC] federal quantification
Unity message push
How does the small program mall refine the operation of members?
Expressions régulières \ \ B \ \ b compréhension de l'appariement des limites des mots
Cannot resolve symbol 'override' of idea clone‘
[MySQL learning] install and use multiple versions of MySQL, MySQL 8 and MySQL 5.7 at the same time, compressed version
Talk about the application of FIFO
An introductory example of structure and combinatorial ideas in go language
uva1344
Unity 消息推送
openEuler 资源利用率提升之道 01:概论