第十周课程总结

这周主要讲解了字节流和字符流的基本操作,两者都有输入和输出操作,在字节流输出数据主要使用OutputStream类完成,输出则是使用InputStream类,在字符流当中输出主要使用Writer类完成,输出则是使用Reader类完成

字节输出流:OutputStream
OutputStream是整个Io包中字节输出流最大的父类此类的定义如下:

 Public abstract class OutputStream
 Extends Object
 Implements Closeable,Flushable 

OutputStream类的常用方法

字节输出流:IntputStream

 Public abstract class InputStream
 Extends Object
 Implements Closeable

InputStream类的常用方法

字符输出流
Writer本身是一个字符流的输出类,此类的定义如下:

 Public abstract class Writer
 Extends Object
 Implements Appendable,Closeable,Flushable

此类本身是一个抽象类,如想使用此类,则必须要是用其子类,此时如果是想文件中写入内容,应该使用FileWriter的子类

Writer类的常用方法

字符输入流:Reader
Reader类是使用字符的方式从文件之中取出数据,Reader的定义如下

 Public abstract class Reader
 Extends Object
 Implements Readable, Closeable

Reader类的常用方法

字节流和字符流的区别

posted @ 2019-11-03 12:51  三问丶  阅读(169)  评论(0编辑  收藏  举报