Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package implementacion;
- import java.io.BufferedReader;
- import java.io.File;
- import java.io.FileReader;
- import java.io.IOException;
- import java.util.ArrayList;
- import java.util.List;
- public class Implementacion {
- public static void main(String[] args) {
- String ruta="C:\\Users\\pablo\\Downloads\\133.txt";
- }
- public static List<String> leer(String nombreArchivo){
- FileReader fr=null;
- File archivo=null;
- List<String>texto=null;
- String linea;
- try{
- archivo=new File(nombreArchivo);
- fr=new FileReader(archivo);
- BufferedReader br=new BufferedReader(fr);
- texto=new ArrayList<String>();
- while((linea=br.readLine())!=null){
- texto.add(linea);
- }
- }catch(IOException e){
- System.out.println(e);
- }finally{
- try{
- if(fr!=null){
- fr.close();
- }
- }catch(IOException e){
- System.out.println(e);
- }
- }
- return texto;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment