-
Notifications
You must be signed in to change notification settings - Fork 0
/
LeitorDeArquivos.java
53 lines (42 loc) · 1.22 KB
/
LeitorDeArquivos.java
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
52
53
package com.T2Alest1;
import java.io.*;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.Scanner;
/**
* Created by Octavio on 6/16/2017.
*/
public class LeitorDeArquivos {
private BufferedReader reader;
private ArrayList<String> lista;
public LeitorDeArquivos(String s) {
try {
reader = new BufferedReader(new FileReader(s));
} catch (FileNotFoundException e) {
e.printStackTrace();
}
lista = new ArrayList<>();
}
public ArrayList<String> leArquivo(){
try {
String s = null;
while((s = reader.readLine()) != null){
//System.out.println(s);
String[] z = new String[2];
z = s.split(";");
lista.add(z[0].toLowerCase());
lista.add(z[1].toLowerCase());
}
} catch (IOException e) {
e.printStackTrace();
}
return lista;
}
public void setPath(String s){
try {
reader = new BufferedReader(new FileReader(s));
} catch (FileNotFoundException e) {
e.printStackTrace();
}
}
}