Package gov.nara.nwts.ftapp

Examples of gov.nara.nwts.ftapp.Timer


    }
   
  }

  public ActionResult importFile(File selectedFile) throws IOException {
    Timer timer = new Timer();
    TreeMap<String,Stats> types = new TreeMap<String,Stats>();
    try {
      BufferedReader br = new BufferedReader(new FileReader(selectedFile));
      int i=1000000;
      for(String line=br.readLine(); line!=null; line=br.readLine()){
        String key = ""+ (i++);
        Stats stats = new Stats(key);
        types.put(key, stats);
        Matcher m = test(line);
        setVals(m, stats, line);
      }
      br.close();
      return new ActionResult(selectedFile, selectedFile.getName(), this.toString(), mydetails, types, true, timer.getDuration());
    } catch (FileNotFoundException e) {
      e.printStackTrace();
    } catch (IOException e) {
      e.printStackTrace();
    }
    return new ActionResult(selectedFile, selectedFile.getName(), this.toString(), mydetails, types, false, timer.getDuration());
  }
View Full Code Here


    br.close();
    return rows;
  }

  public ActionResult importFile(File selectedFile) throws IOException {
    Timer timer = new Timer();
    forceKey = dt.getImporterForceKey();
    BufferedReader br = new BufferedReader(new FileReader(selectedFile));
    int colcount = 0;
    TreeMap<String,Stats> types = new TreeMap<String,Stats>();
    for(String line=br.readLine(); line!=null; line=br.readLine()){
      Vector<String> cols = parseLine(line, getSeparator());
      colcount = Math.max(colcount,cols.size());
      String key = cols.get(0);
      if (forceKey) {
        key = "" + (rowKey++);
      }
      Stats stats = new Stats(key);
      if (forceKey) {
        stats.vals.add(cols.get(0));
      }
      for(int i=1; i<cols.size(); i++){
        stats.vals.add(cols.get(i));
      }
      types.put(key, stats);
    }
    Object[][] details = (forceKey) new Object[colcount+1][5] : new Object[colcount][5];
    if (forceKey) {
      details[0][0] = String.class;
      details[0][1] = "Col0";
      details[0][2] = 100;
      details[0][4] = false;
      for(int i=0; i<colcount; i++) {
        details[i+1][0] = String.class;
        details[i+1][1] = "Col" + (i+1);
        details[i+1][2] = 100;
        details[i+1][4] = true;
      }

    } else {
      for(int i=0; i<colcount; i++) {
        details[i][0] = String.class;
        details[i][1] = "Col" + i;
        details[i][2] = 100;
        details[i][4] = true;
      }     
    }
    return new ActionResult(selectedFile, selectedFile.getName(), this.toString(), details, types, true, timer.getDuration());
  }
View Full Code Here

  public FileListImporter(FTDriver dt) {
    super(dt);
  }

  public ActionResult importFile(File selectedFile) throws IOException {
    Timer timer = new Timer();
    TreeMap<String,Stats> types = new TreeMap<String,Stats>();
    FileReader fr = new FileReader(selectedFile);
    BufferedReader br = new BufferedReader(fr);
    for(String line=br.readLine(); line!=null; line=br.readLine()){
      File f=new File(line);
      String s = f.getName();
      Stats stats = new Stats(s);
      types.put(s,stats);
    }     
    return new ActionResult(selectedFile, selectedFile.getName(), this.toString(), details, types, true, timer.getDuration());
  }
View Full Code Here

TOP

Related Classes of gov.nara.nwts.ftapp.Timer

Copyright © 2018 www.massapicom. 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.