Examples of BufferedReader


Examples of java.io.BufferedReader

    String costName = train.relationName() + CostMatrix.FILE_EXTENSION;
    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);
   
View Full Code Here

Examples of java.io.BufferedReader

  protected String postOnEndPoint(String postBody) throws MalformedURLException, IOException {
    HttpURLConnection connection = (HttpURLConnection) new URL(END_POINT).openConnection();
    connection.setRequestProperty("Content-Type", "application/json");
    connection.setDoOutput(true);
    connection.getOutputStream().write(postBody.getBytes());
    BufferedReader bufReader = new BufferedReader(new InputStreamReader(connection.getResponseCode() < 300 ? connection.getInputStream() :
      connection.getErrorStream()));
    StringBuffer buf = new StringBuffer();
    String str = bufReader.readLine();
    while(str != null){
      buf.append(str);
      str = bufReader.readLine();
    }
    bufReader.close();
    connection.disconnect();
    return buf.toString();
  }
View Full Code Here

Examples of java.io.BufferedReader

     *
     * @return the message
     */
    protected String receive() {
        try {
            return new BufferedReader(new InputStreamReader(System.in)).readLine();
        } catch (IOException e) {
            throw new RuntimeException("Error reading from input", e);
        }
    }
View Full Code Here

Examples of java.io.BufferedReader

   * @param id
   * @return
   */
  public static String getTextContent(int type, long id){
    String path = getFilePath(type, id);
    BufferedReader br = null;
    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);
        text.append(line_sep);
      }while(true);
      return text.toString();
    }catch(FileNotFoundException e){
    }catch(IOException e){
      log.error("Exception occur when reading " + path, e);
    }finally{
      if(br!=null){
        try{
          br.close();
        }catch(IOException e){}
      }
      text = null;
    }
    return null;
View Full Code Here

Examples of java.io.BufferedReader

        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

Examples of java.io.BufferedReader

        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

Examples of java.io.BufferedReader

        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

Examples of java.io.BufferedReader

        System.gc();

        // LRU + spinlock
        String filename = FileUtils.basename(inputFile);
        BufferedReader reader = new BufferedReader(new FileReader(file));
        runBenchmarkWithZipfDistribution1(new AtomicBackoffLock(), filename, threads, capacity, round, scanPercentage, scanLength, ReplacementAlgorithm.LRU, pageSize, reader);
        IOUtils.closeQuietly(reader);

        System.gc();

        reader = new BufferedReader(new FileReader(file));
        runBenchmarkWithZipfDistribution2(new AtomicBackoffLock(), filename, threads, capacity, round, scanPercentage, scanLength, ReplacementAlgorithm.LRU, pageSize, reader);
        IOUtils.closeQuietly(reader);
    }
View Full Code Here

Examples of java.io.BufferedReader

        System.gc();

        // LRU + sync
        String filename = FileUtils.basename(inputFile);
        BufferedReader reader = new BufferedReader(new FileReader(file));
        runBenchmarkWithZipfDistribution1(null, filename, threads, capacity, round, scanPercentage, scanLength, ReplacementAlgorithm.LRU, pageSize, reader);
        IOUtils.closeQuietly(reader);

        System.gc();

        reader = new BufferedReader(new FileReader(file));
        runBenchmarkWithZipfDistribution2(null, filename, threads, capacity, round, scanPercentage, scanLength, ReplacementAlgorithm.LRU, pageSize, reader);
        IOUtils.closeQuietly(reader);
    }
View Full Code Here

Examples of java.io.BufferedReader

        System.gc();

        // 2Q + spinlock
        String filename = FileUtils.basename(inputFile);
        BufferedReader reader = new BufferedReader(new FileReader(file));
        runBenchmarkWithZipfDistribution2(new AtomicBackoffLock(), filename, threads, capacity, round, scanPercentage, scanLength, ReplacementAlgorithm.FullTwoQueue, pageSize, reader);
        IOUtils.closeQuietly(reader);
    }
View Full Code Here
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.