나는 다음과 같은 오류가 있습니다IOException - 그 이유는 모르겠습니까?
java.io.WriteAbortedException: writing aborted; java.io.NotSerializableException: flexitime.UniSystems
이에 대한 일반적인 이유는 무엇입니까? storage.dat라는 파일을 읽으려고합니다.
이 오류를 얻을 코드는
private void loadFile() {
try {
FileInputStream inStream = new FileInputStream(fileName);
ObjectInputStream inputObjects = new ObjectInputStream(inStream);
system = (UniSystems)inputObjects.readObject();
inStream.close();
}
catch (ClassNotFoundException err) {
// Class in the file does not have a matching class definition
JOptionPane.showMessageDialog(null, "Please contact IT Support quoting code CNF",
"Application error!", JOptionPane.ERROR_MESSAGE);
err.printStackTrace();
}
catch (IOException err) {
// Some other IO error has occurred
JOptionPane.showMessageDialog(null, "Please contact IT Support quoting code IIO",
"Application error!", JOptionPane.ERROR_MESSAGE);
err.printStackTrace();
}
}
그것은 2 캐치까지를 통해 만든 다음 오류가 다시 발생합니다. 아이디어가 있으십니까?
"UniSystems"가 Serializable을 구현하지 않는 것처럼 보이는 예외에서. 당신이 읽고있는 물건이 맞습니까? –
어디에서 직렬화가 필요합니까? 그리고이 파일은 UniSystems를 읽어 들인 다음 UniSystems를 사용하여 채우기 작업을 수행합니다. – sark9012