## 对象流进行IO流的对象读写
- 对象流的作用就是对象从内存写到文件中,或者将文件读取到内存中,这个过程叫序列化(写出),反之就是反序列化(读取)
- ObjectInputStream
- ObjectOutputStream
```java
Person p = new Person();
p.name = "jack";
p.age = 19;
// p.show();
ObjectInputStream ois = new ObjectInputStream(new FileInputStream("a.txt"));
Object obj = ois.readObject();
Person p2 = (Person)obj;//p2 存储的是a.txt文件中存储的对象
p2.show();// jack...19
ois.close();
// // 创建一个对象输出流
// ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream("a.txt"));
// // 写入数据
// oos.writeObject(p);
// // 关闭流
// oos.close();
System.out.println("搞定");
```