我想读取已输出到 .dat 文件的多个对象(我自己的类 Term),但我总是得到 nullPointException 或 EOFException。
ObjectInputStream inputStream = new ObjectInputStream(new FileInputStream(masterFile));
Object o = null;
while(( o = inputStream.readObject()) != null){
Term t = (Term)o;
System.out.println("I found a term");
}