对象流分为
对象输入流 ObjectInputStream
对象输出流 ObjectOutputStream
对象输入流的构造方法
publicObjectInputStream(InputStreamin) 从文件中读取对象时•FileInputStreama=newFileInputStream("tom.txt"); •ObjectInputStreamin=newObjectInputStream(a);
对象输出流的构造方法
publicObjectOutputStream(OutputStreamout) 将对象写入到文件时•FileOutputStreamb=newFileOutputStream("tom.txt"); •ObjectOutputStreamout=newObjectOutputStream(b);
对象流的成员方法
ObjectInputStream类的读方法publicfinalObjectreadObject() throwsIOException, ClassNotFoundExceptionObjectOutputStream类的写方法publicfinalvoidwriteObject(Objectobj) throwsIOException