Problème avec les flux FileOutputStream
Bonjour,
j'ai un problème pour écrire dans un fichier !!!
NetBeans me dit : Cannot find symbol sur la fonction d'écriture
Voici la partie de code qui me pose problème :
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 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
| private void CreationActionPerformed(java.awt.event.ActionEvent evt) {
int anneea=0;
Genre.setText("genre de la piece");
annee.setText("Annee d'acquisition");
try
{
anneea=Integer.parseInt(this.annee.getText());
}
catch(Exception E) {
System.out.println("L'annee est mauvaise");
}
PieceMuseeScNaturelle nouvelle=new PieceMuseeScNaturelle(this.Genre.getText(),anneea);
nouvelle.origine = this.orig.getText();
nouvelle.habitat=this.habite.getText();
switch(jComboBox2.getSelectedIndex()) {
case 0:
nouvelle.alcoolisee=true;
break;
case 1:
nouvelle.alcoolisee=false;
break;
}
switch(jComboBox1.getSelectedIndex()) {
case 0:
nouvelle.etat='C';
break;
case 1:
nouvelle.etat='P';
break;
case 2:
nouvelle.etat='E';
break;
case 3:
nouvelle.etat='X';
break;
case 4:
nouvelle.etat='T';
break;
}
nouvelle.affiche();
try
{
File fo =new File("C:\\piece.txt");
FileOutputStream fos=new FileOutputStream(fo);
try
{
fos.write(nouvelle);
}
catch(Exception IOException)
{
System.out.println("probleme d'ecriture");
}
fos.close();
}
catch(Exception FileNotFound)
{
System.out.println("probleme de fichier");
}
} |
la ligne en gras est celle qui pose problème.
Merci d'avance