我给你举一个例子,例如,要从由 ObjectOutputStream 中的示例写入的流读取,编码如下;
FileInputStream fis = new FileInputStream("t.tmp");
ObjectInputStream ois = new ObjectInputStream(fis);
int i = ois.readInt();
String today = (String) ois.readObject();
Date date = (Date) ois.readObject();
ois.close();