Package modelo

Source Code of modelo.LectorFicheros

package modelo;

import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;



public class LectorFicheros {

  public static List<java.util.Hashtable> read() {
    try {
      List<java.util.Hashtable> list= new ArrayList<java.util.Hashtable>();
      FileReader file = new FileReader("configuration.conf");
      Scanner scanner = new Scanner(file);

      while (scanner.hasNextLine()){
        java.util.Hashtable hashFile = new java.util.Hashtable();

        boolean end=false;

        while ((scanner.hasNextLine())&&(!end)) {
          end=scanner.hasNext(":");
          String name = "", value="";  
          Scanner line = new Scanner(scanner.nextLine());
          line.useDelimiter("=");     
          if(line.hasNext())
            name = line.next();       
          if(!name.startsWith("#") & line.hasNext()){
            value = line.next();
            hashFile.put(name.trim(), value.trim());
          }
          line.close();
        }
        list.add(hashFile);
      }
      scanner.close();
      file.close();
      return list;
    }
    catch (IOException e) {
      e.printStackTrace();
      return null;
   
  }

//TODO: tenemos que crear la lectura del fichero de creacion del tablero desde un fichero de configuracion que lleve a su vez JARGS
 
 
 
 
 
}
TOP

Related Classes of modelo.LectorFicheros

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.