Bonjour a tous.

Voila, je dois ecrire certain resultat de fonction dans un fichier et j utilise pour l instant ceci

Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
 
 
public class Write_file {
 
	static String  writeString2Path (String texteFlux){
		String path = new String("path/.../.../log1.log");
		FileWriter writer = null;											//Creation d'un nouveau fichier modifie
		String texte = texteFlux;
		try{
 
			writer = new FileWriter(path, false);
			writer.write(texte,0,texte.length());
		}catch(IOException ex){
			ex.printStackTrace();
		}finally{
			if(writer != null){
				try {
					writer.close();
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
		}
 
		return path;
	}
 
}
Cependant j appelle cette methode plusieur fois, afin de concatener mes resultats.
Et je voudrais , qu a chaque fois que je lance mon programe une nouvelle fois, il me cree un nouveau fichier (log1,log2,...par exemple)
Y a t il une astuce, une classe?
Sinon comment puis je m y prendre?

Merci