文件流

Input流 读取文件 输入流
Output流 写入文件 输出流
字节流 byte 用于二进制文件的读写
字符流 char 用于文本文件的读写
二进制(字节)输入流
InputStream

FileInputStream 文件流 BufferedInputStream 处理流 缓冲 对接文件流
ObjectInputStream 所有类型的流
public abstract int read()throws IOExceotion 读括号内的File对象赋值给流
public abstract int read (byte[] b)throws IOException将读到的数据传给 字节数组b储存
public abstract int read(byte [] b,int off,int len)throws IOException 将读到的数据给字节数组储存 确定范围。
public void close() throws IOException关闭流

字符输入流
reader
InputStreamReader
FileReader(直接用这个建立就可以) BufferedReader缓冲流 StringReader CharArrayReader
public int read() throws IOException
public int read(char [] cbuf) throws IOException
public int read(char [] cbuf,int off,int len) throws IoException
public void close() throws IOException
含义 同上

字节输出流
OutputSteam
FileOutputStream 文件输出流
BufferedOutputStream 缓冲流
ObjectOutputStream 任意类型流
public void write(int b) throws IOException
public void write(byte [])throws IOException
public void write(byte [],int off,int len) throws IOException
public void close() throws IOException

字符输出流
Writer
OutputStreamWriter
FileWriter 文件输出流
public void write(int b)throws IOException
public void write (chars [] b)throws IOException
public abstract void write(chars[] b,int off,int len)throws IOException
public void write(String str) throws IOException
public void close() throws IOException

posted on 2020-04-25 22:07  苏阔Garrison  阅读(86)  评论(0编辑  收藏  举报

导航