-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFile.java
More file actions
43 lines (42 loc) · 1.15 KB
/
File.java
File metadata and controls
43 lines (42 loc) · 1.15 KB
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
import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;
import java.io.Writer;
public class File implements Observateur{
private Writer w;
public File(String path){
try{
this.w=new BufferedWriter(new FileWriter(path));
}
catch (IOException e){
System.out.println("Erreur avec le fichier pour la création");
}
}
public void notifier(String message){
try{
this.w.write(message);
this.w.flush();
}
catch (IOException e){
System.out.println("Erreur avec le fichier pour la notification de "+message);
}
}
public void notifier(char ch){
try{
this.w.write(ch);
this.w.flush();
}
catch (IOException e){
System.out.println("Erreur avec le fichier pour la notification de "+ch);
}
}
public void notifier(int nb){
try{
this.w.write(nb);
this.w.flush();
}
catch (IOException e){
System.out.println("Erreur avec le fichier pour la notification de "+nb);
}
}
}