-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathReadReputationCheckFile.java
More file actions
36 lines (26 loc) · 927 Bytes
/
ReadReputationCheckFile.java
File metadata and controls
36 lines (26 loc) · 927 Bytes
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
import java.io.File;
import java.io.FileNotFoundException;
import java.util.ArrayList;
import java.util.Scanner;
/*
This class reads the specified file containing the lists of websites and returns it in an ArrayList
*/
public class ReadReputationCheckFile {
public ArrayList returnList(String fileName) throws FileNotFoundException {
ArrayList<String> maliciousWebsites = new ArrayList();
try {
Scanner scanner = new Scanner(new File(fileName));
String[] nextLine;
while (scanner.hasNext()) {
nextLine = scanner.nextLine().split(",");
String website = nextLine[1];
maliciousWebsites.add(website);
}
}
catch (Exception e){
System.out.println("File not found");
}
maliciousWebsites.remove(maliciousWebsites.get(0));
return maliciousWebsites;
}
}