slt je désirais uplode un fichier mais voilà une exception de type :StreamCorruptedException mes léve
m'informant que mon fichier est corrompu.
code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
| //......
JFileChooser foldere= new JFileChooser();
File file,lefichier;
//......
if(foldere.showOpenDialog(null) ==JFileChooser.APPROVE_OPTION){
if(foldere.getFileFilter().accept(foldere.getSelectedFile())){
try{
file = foldere.getSelectedFile();
ObjectInputStream ois = new ObjectInputStream(new FileInputStream(file));
lefichier=(File) ois.readObject();
//...
ois.close();
}
catch(FileNotFoundException e1){
e1.printStackTrace();
}
catch (IOException e2) {
e2.printStackTrace();
}
catch (ClassNotFoundException e3) {
e3.printStackTrace();
}
catch (Exception e4) {
e4.printStackTrace();
}
}
} |
je pense que la ligne qui provoque l'exception est:
lefichier=(File) ois.readObject();
et là je ne comprend pas bien ,je suis in peut perdus,ainsi toute aide,assistance où conseil serrais
la bien venu.
a++
Partager