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
|
//copie de l'en-tête type de dia, avec le BOM
FileInputStream in=new FileInputStream("Header.dia");
FileOutputStream out=new FileOutputStream(strChemin);
FileChannel src=in.getChannel();
FileChannel dest=out.getChannel();
src.transferTo(0, src.size(), dest);
src.close();
dest.close();
//a ce niveau, le fichier généré contient bien le BOM
bw=new BufferedWriter(new FileWriter(new File(strCheminFichier), true));
strTemp="\n";
bw.write(strTemp);
bw.flush();
for (int i=0; i<nbNoeud; i++)
{
(...)
//tous les arguments ci-dessous sont de type String
bw.write(strBackground+currentNoeud.getConstat()+strEndString+strNewLine);
bw.flush();
//a la fin de la premiere boucle, le fichier contient toujours le BOM
//après la deuxième boucle, le fichier ne contient plus le BOM !
}
bw.close(); |
Partager