無論如何檢查類ObjectInputStream的方法readObject是否已完成讀取文件,而不是捕獲其拋出的異常?ReadObject方法
如果否。我怎麼能make outNemamast.writeObject(accountRecord);在這種情況下達成的聲明?
// read oldmast.ser
try {
while (true) {
accountRecord = (AccountRecord) inOldmast.readObject();
//read trans.ser
while (true) {
transactionRecord = (TransactionRecord) inTrans.readObject();
if (transactionRecord.getAccountNumber() == accountRecord.getAccount()) {
accountRecord.combine(transactionRecord);
}//end if
}//end inner while
outNewmast.writeObject(accountRecord);
}//end while
}//end try
catch (ClassNotFoundException e) {
System.err.println("Error reading file.");
System.exit(1);
}//end catch
catch (IOException e) {
System.err.println("Error reading file.");
System.exit(1);
}//end catch
你錯過了():d反正非常感謝你。 – Kareem 2013-03-05 11:59:58
固定。謝謝。 :) – 2013-03-05 12:01:28