二 IO
2.1 简介
step01-输入流与输出流的解释
2.2 OutputStream
2.2.1简介
2.2.2 常用的方法
2.2.3 子类
2.3 FileOutputStream
2.3.1简介
2.3.2 构造方法
2.3.3 构造方法的三件事
2.3.4 使用的步骤
2.3.5 一个一个字节写入
public static void main(String[] args) throws IOException {
FileOutputStream os = new FileOutputStream("D:\\a\\b\\c\\d.txt");
os.write(97);
os.write(98);
os.write(99);
os.close();
}
abc
2.3.6 一次写入多个字节
public static void main(String[] args) throws IOException {
FileOutputStream os = new FileOutputStream("D:\\a\\b\\c\\d.txt");
byte [] b = new byte[]{98,99,100,101};
os.write(b);
os.close();
}
bcde
2.3.7 使用字节流写字符串到文件中
FileOutputStream os = new FileOutputStream("D:\\a\\b\\c\\d.txt");
byte [] b = new byte[]{98,99,100,101};
os.write(b,0,1);
os.close();
b
2.3.8 写入的原理
2.3.9 写入的内容说明
2.4 InputStream
2.2.1简介
2.2.2 常用方法
2.2.3 子类
2.5 FileInputStream
2.5.1简介
2.3.2 构造方法