Oui, c'est vraiment tout ce qu'il m'affiche, c'est la première fois que ca me fait ca.
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51 public class ReadFile { public static ArrayList<iso.Country> ReadFile(String pathToFile, String pathToFile2){ String country; ArrayList<Country> countries = new ArrayList<Country>(); try { BufferedReader reader1 = new BufferedReader(new FileReader(new File(pathToFile))); BufferedReader reader2 = new BufferedReader(new FileReader(new File(pathToFile2))); for(String line1=reader1.readLine(); line1!=null; line1=reader1.readLine()) { String line2 = reader2.readLine(); if ( line2==null ) { throw new IOException("Fichier 2 trop court"); } String[] champLine1 = line1.split(",,"); country = champLine1[0]; String[] champLine2 = line2.split("\t "); if ( champLine2[1].equals(country) ) { } else { System.out.println("Le pays " + country + "n'est pas présent dans votre second fichier"); } } } catch (Exception ex){ System.err.println("Error. "+ex.getMessage()); } return countries; } public static void main(String[] args){ ReadFile("/Users/dell/Desktop/Cours/ISO/POP.csv","/Users/dell/Desktop/Cours/ISO/rawdata_2147.txt"); } }
Partager