线程
在Obiect类中提供了wait()、notify()、 notfyAll()方法用于解决线程间的通信问题
1.创建线程:Thread、Runable、重写run();start();stop();
2.线程同步:方法、代码块
3.线程协作:wait() notify
4.线程休眠:sleep()
5.同步方法:synchronized 返回值类型 方法名 {}
一. 文件读写操作
1.java IO:输入输出流:一组有序的、起点、终点、字节的集合、对数据传输总称。
2.读取磁盘数据、网络数据、输入、输出
3.缓冲区技术60K
4.字节、字符
字节Stream 输入Inputstream 输出 outputstream
子类:File Inputstream File outputstream
piped Inputstream piped outputstream
data Inputstream data outputstream 二进制的
⬇
父类:Filter Inputstream
System.in System.out
二. 文件自身操作
1.文件操作类
File Inputstream
▲File Inputstream fin=new File Inputstream(“F:\a.txt”);
▲read():每次读一个字节,返回值-1文件末尾
▲while ((ch=fin.read())!=-1
▲(char)ch
▲byte buff []=new byte[1024] 设置缓冲区
▲while (fin.read(buff))!=-1)
▲new string (buff):字符串
▲available():可以返回文件内容大小
▲ship(n):可以跳过n个字节
▲文件读取完关闭流close();