一、字节缓冲输出流
1、使用步骤
1、创建FileOutputStream对象,构造方法中要绑定要输出的目的地
2、创建BufferedOutputStream对象,构造方法中传递FileOutputStream对象对象,提高FileOutputStream对象对象效率
3、使用BufferedOutputStream对象中的方法write,把数据写入到内部缓冲区中
4、使用BufferedOutputStream对象中的方法flush,把内存缓冲区中的数据刷新到文件中
5、释放资源
2、代码1
public class Demo01 {
public static void main(String[] args) throws IOException {
FileOutputStream fos = new FileOutputStream("E:\\F.txt");
BufferedOutputStream bos = new BufferedOutputStream(fos);
bos.write("你好!世界!".getBytes());
bos.flush();
bos.close(