-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy patharchivo.java
More file actions
36 lines (29 loc) · 845 Bytes
/
archivo.java
File metadata and controls
36 lines (29 loc) · 845 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.*;
import java.util.ArrayList;
public class archivo {
public ArrayList<String> leerArchivo() {
ArrayList<String> lista = new ArrayList<String>();
File archivo = null;
FileReader fr = null;
BufferedReader br = null;
try {
archivo = new File("archivo.txt");
fr = new FileReader(archivo);
br = new BufferedReader(fr);
String linea;
while ((linea = br.readLine()) != null)
lista.add(linea);
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
if (null != fr) {
fr.close();
}
} catch (Exception e2) {
e2.printStackTrace();
}
}
return lista;
}
}