Urgent: invalid stream header: 5B47656E
Code :
if (fileDialog == null) {
fileDialog = new FileDialog(frame);
}
fileDialog.setMode(FileDialog.LOAD);
fileDialog.show();
String file = fileDialog.getFile();
if (file == null) {
return;
}
String directory = fileDialog.getDirectory();
File f = new File(directory, file);
if (f.exists()) {
try {
FileInputStream fin = new FileInputStream(f);
[B] ObjectInputStream istrm = new ObjectInputStream(fin);[/B]
Document doc = (Document) istrm.readObject();
if(getEditor().getDocument() != null)
getEditor().getDocument().removeUndoableEditListener
(undoHandler);
getEditor().setDocument(doc);
doc.addUndoableEditListener(undoHandler);
resetUndoManager();
frame.setTitle(file);
validate();
} catch (IOException io) {
// should put in status panel
System.err.println("IOException: " + io.getMessage());
} catch (ClassNotFoundException cnf) {
// should put in status panel
System.err.println("Class not found: " + cnf.getMessage());
}
} else {
// should put in status panel
System.err.println("No such file: " + f);
}
The code written above is throwing invalid stream header exception.Please help me out to get rid of this i had tried a lot , but on the line highlighted above its throwing exception.I already search a lot on internet but not get any solution.Its urgent for my project please help me out.