是按照字节进行操作的,每次读取一个字节
字节流抽象基类:
InputStream(字节输入流)/OutputStream(字节输出流)
子类:
FileInputStream
public int read()
从此输入流中读取一个数据字节。
public int read(byte[] b)
从此输入流中将最多 b.length 个字节的数据读入一个 byte 数组中。
public int read(byte[] b,int off,int len)
从此输入流中将最多 len 个字节的数据读入一个 byte 数组中。off:目标数组 b 中的起始偏移量。
FileOutputStream
public void write(int b)
public void write(byte[] b)
public void write(byte[] b,int off,int len)
指定 byte 数组中从偏移量 off 开始的 len 个字节写入此文件输出流。
字节流缓冲流
BufferedInputStream/BufferedOuputStream
字符流
Reader(字符输入流)/Writer(字符输出流)
子类:
FileReader常用方法:
public int read()
读取单个字符
public int read(char[] b)
将字符读入数组
public int read(char[] b,int off,int len)
将字符读入数组的某一部分。
FileWriter
public void write(String str)
public void write(String str,int off,int len)
public void
字节流是按照字节进行操作的,每次读取一个字节字节流抽象基类:InputStream(字节输入流)/OutputStream(字节输出流)子类:FileInputStream public int read() 从此输入流中读取一个数据字节。 public int read(byte[] b) 从此输入流中将最多 b.length 个字节的数据...