je veux modifier ma classe pour q'elle prend le path du fichier en entrée ( bufferreader input ) en paramètre
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
29
30
31
32
33 public class maClass { public static String r ; public maClass ( String r ){ r = this.r ; } private static String getpath (){ return r ; } public void setpath (String path){ r= path ; } public static int rejetChap (String in) throws IOException{ BufferedReader chapin = new BufferedReader(new FileReader("D://pfe//chap rejeté.txt")); String chapline = chapin.readLine(); int a =0; while (chapline !=null ){ if (in.substring(267,277).startsWith(chapline)) a=a+1; chapline=chapin.readLine();} return a ; } public static void main (String[] args) throws IOException { BufferedReader input = new BufferedReader(new FileReader(r)); PrintWriter pt = new PrintWriter (new FileWriter ("D://struct.txt")); BufferedReader in = new BufferedReader(new FileReader("D://struct.txt")); PrintWriter out = new PrintWriter (new FileWriter ("D://mail.txt")); PrintWriter out2 = new PrintWriter (new FileWriter("D://etrangé.txt")); PrintWriter edit = new PrintWriter (new FileWriter("D:// editable.txt"));
Partager