Package java.io

Examples of java.io.FileReader


    File wekaHome = WekaPackageManager.WEKA_HOME;
    File dialogSubDir = new File(wekaHome.toString() + File.separator
        + "systemDialogs" + File.separator + dialogName);

   
    BufferedReader br = new BufferedReader(new FileReader(dialogSubDir));
    String response = br.readLine();
   
    br.close();
    return response;
  }
View Full Code Here


          +" weka.classifiers.meta.CostSensitiveClassifier or"
          +" weka.classifiers.meta.MetaCost");

      Reader costReader = null;
      try {
        costReader = new BufferedReader(new FileReader(costFileName));
      } catch (Exception e) {
        throw new Exception("Can't open file " + e.getMessage() + '.');
      }
      try {
        // First try as a proper cost matrix format
        return new CostMatrix(costReader);
      } catch (Exception ex) {
        try {
          // Now try as the poxy old format :-)
          //System.err.println("Attempting to read old format cost file");
          try {
            costReader.close(); // Close the old one
            costReader = new BufferedReader(new FileReader(costFileName));
          } catch (Exception e) {
            throw new Exception("Can't open file " + e.getMessage() + '.');
          }
          CostMatrix costMatrix = new CostMatrix(numClasses);
          //System.err.println("Created default cost matrix");
View Full Code Here

    }

    public Reader getReader() throws FileNotFoundException {
        if (reader == null) {
            // return a fresh reader on every get, because multiple reads should be possible:
            return new FileReader(fileName);
        }
        return reader;
    }
View Full Code Here

  public static void main(String [] args) {
    if(args.length!=3) {
      final JFrame jf = new JFrame("AttribVisualization");
      AttributeVisualizationPanel ap = new AttributeVisualizationPanel();
      try {
        Instances ins = new Instances( new FileReader(args[0]) );
        ap.setInstances(ins);
        System.out.println("Loaded: "+args[0]+
                           "\nRelation: "+ap.m_data.relationName()+
                           "\nAttributes: "+ap.m_data.numAttributes());
        ap.setAttribute( Integer.parseInt(args[1]) );
View Full Code Here

    File costFile = new File(getOnDemandDirectory(), costName);
    if (!costFile.exists()) {
      throw new Exception("On-demand cost file doesn't exist: " + costFile);
    }
    CostMatrix costMatrix = new CostMatrix(new BufferedReader(
    new FileReader(costFile)));
   
    Evaluation eval = new Evaluation(train, costMatrix);   
    m_Classifier = AbstractClassifier.makeCopy(m_Template);
   
    trainTimeStart = System.currentTimeMillis();
View Full Code Here

    StringBuffer text = new StringBuffer();
    try{
      String line_sep = System.getProperty("line.separator");
      if(line_sep==null)
        line_sep = "\r\n";
      br = new BufferedReader(new FileReader(path));
      do{
        String line = br.readLine();
        if(line == null)
          break;
        text.append(line);
View Full Code Here

      throw new RuntimeException(e); // should be impossible with StringReader
    }
  }
 
  public Template(File templateFile) throws FileNotFoundException {
    FileReader r = new FileReader(templateFile);
    try {
      t = new Jtpl(templateFile);
    } catch (IOException e) {
      try {
        r.close();
      } catch (Exception nothingToDoAboutIt) {}
    }
  }
View Full Code Here

        File file = new File(inputFile);
        if(!file.exists()) {
            Assert.fail("file not found: " + inputFile);
        }
        String filename = FileUtils.basename(inputFile);
        BufferedReader reader = new BufferedReader(new FileReader(file));
        runBenchmarkWithZipfDistribution(filename, capacity, round, scanPercentage, scanLength, ReplacementAlgorithm.GClockK, reader);
        IOUtils.closeQuietly(reader);
        reader = new BufferedReader(new FileReader(file));
        runBenchmarkWithZipfDistribution(filename, capacity, round, scanPercentage, scanLength, ReplacementAlgorithm.GClock, reader);
        IOUtils.closeQuietly(reader);
        reader = new BufferedReader(new FileReader(file));
        runBenchmarkWithZipfDistribution(filename, capacity, round, scanPercentage, scanLength, ReplacementAlgorithm.LRU, reader);
        IOUtils.closeQuietly(reader);
    }
View Full Code Here

        System.gc();

        // GClockK
        String filename = FileUtils.basename(inputFile);
        BufferedReader reader = new BufferedReader(new FileReader(file));
        runBenchmarkWithZipfDistribution1(new NoopLock(), filename, threads, capacity, round, scanPercentage, scanLength, ReplacementAlgorithm.GClockK, pageSize, reader);
        IOUtils.closeQuietly(reader);
    }
View Full Code Here

        System.gc();

        // GClock
        String filename = FileUtils.basename(inputFile);
        BufferedReader reader = new BufferedReader(new FileReader(file));
        runBenchmarkWithZipfDistribution1(new NoopLock(), filename, threads, capacity, round, scanPercentage, scanLength, ReplacementAlgorithm.GClock, pageSize, reader);
        IOUtils.closeQuietly(reader);
    }
View Full Code Here

TOP

Related Classes of java.io.FileReader

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.