pablosotol

Untitled

Jun 13th, 2016
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.95 KB | None | 0 0
  1. package implementacion;
  2.  
  3.  
  4. import java.io.BufferedReader;
  5. import java.io.File;
  6. import java.io.FileReader;
  7. import java.io.IOException;
  8. import java.util.ArrayList;
  9. import java.util.List;
  10.  
  11. public class Implementacion {
  12.  
  13.     public static void main(String[] args) {
  14.            String ruta="C:\\Users\\pablo\\Downloads\\133.txt";
  15.            List<String>archivo;
  16.            archivo=leer(ruta);
  17.            if(comprobar(archivo)){
  18.               ATexto at=new ATexto(ruta,archivo);
  19.            }else{
  20.                
  21.            }
  22.            
  23.            
  24.     }
  25.    
  26.     public static boolean comprobar(List<String> l){
  27.            boolean estexto=false;
  28.            for(String linea: l){
  29.                for(int i=0;i<linea.length();i++){
  30.                    if(linea.charAt(i)=='.' || linea.charAt(i)=='-' || linea.charAt(i)=='/' || linea.charAt(i)==' '){
  31.                          
  32.                    }else{
  33.                       estexto=true;
  34.                    }
  35.                }
  36.            }
  37.            return estexto;
  38.     }
  39.    
  40.     public static List<String> leer(String laRuta){
  41.               FileReader fr=null;
  42.               File archivo=null;
  43.               List<String>texto=null;
  44.               String linea;
  45.               try{
  46.                   archivo=new File(laRuta);
  47.                   fr=new FileReader(archivo);
  48.                   BufferedReader br=new BufferedReader(fr);
  49.                   texto=new ArrayList<String>();
  50.                   while((linea=br.readLine())!=null){
  51.                         texto.add(linea);
  52.                   }
  53.               }catch(IOException e){
  54.                   System.out.println(e);
  55.               }finally{
  56.                   try{
  57.                       if(fr!=null){
  58.                          fr.close();
  59.                       }
  60.                   }catch(IOException e){
  61.                       System.out.println(e);
  62.                   }
  63.               }
  64.               return texto;
  65.        }
  66. }
Advertisement
Add Comment
Please, Sign In to add comment