Package org.apache.hadoop.fs

Examples of org.apache.hadoop.fs.FSDataOutputStream.writeChar()


  public void testOutputStreamClosedTwice() throws IOException {
    //HADOOP-4760 according to Closeable#close() closing already-closed
    //streams should have no effect.
    Path src = path("/test/hadoop/file");
    FSDataOutputStream out = fs.create(src);
    out.writeChar('H'); //write some data
    out.close();
    out.close();
  }
 
  protected Path path(String pathString) {
View Full Code Here


    fs.createNewFile(FROM);

    FSDataOutputStream output = fs.create(FROM, true);
    for(int i = 0; i < 100; ++i) {
        output.writeInt(i);
        output.writeChar('\n');
    }
    output.close();
    fs.setTimes(FROM, MODIFICATION_TIME, 0);
    fs.setPermission(FROM, PERMISSIONS);
    fs.setTimes(new Path("d1"), MODIFICATION_TIME, 0);
View Full Code Here

            // this is the first value, it contains the name of the input file
            ofile = fs.create(new Path(outputPath, value).suffix(".out"));
          } else {
            // The key contains the correct label of the data. The value contains a prediction
            ofile.writeChars(value); // write the prediction
            ofile.writeChar('\n');

            resList.add(new double[]{key, Double.valueOf(value)});
          }
        }
      } finally {
View Full Code Here

      Instance instance = converter.convert(0, line);
      int prediction = forest.classify(rng, instance);

      if (outputPath != null) {
        ofile.writeChars(Integer.toString(prediction)); // write the prediction
        ofile.writeChar('\n');
      }

      if (analyzer != null) {
        analyzer.addInstance(dataset.getLabel(instance.getLabel()),
                             new ClassifierResult(dataset.getLabel(prediction), 1.0));
View Full Code Here

            // this is the first value, it contains the name of the input file
            ofile = fs.create(new Path(outputPath, value.toString()).suffix(".out"));
          } else {
            // The key contains the correct label of the data. The value contains a prediction
            ofile.writeChars(value.toString()); // write the prediction
            ofile.writeChar('\n');

            if (analyzer != null) {
                analyzer.addInstance(
                        dataset.getLabel((int)key.get()),
                        new ClassifierResult(dataset.getLabel(Integer.parseInt(value.toString())), 1.0));
View Full Code Here

  public void testOutputStreamClosedTwice() throws IOException {
    //HADOOP-4760 according to Closeable#close() closing already-closed
    //streams should have no effect.
    Path src = path("/test/hadoop/file");
    FSDataOutputStream out = fs.create(src);
    out.writeChar('H'); //write some data
    out.close();
    out.close();
  }
 
  protected Path path(String pathString) {
View Full Code Here

            // this is the first value, it contains the name of the input file
            ofile = fs.create(new Path(outputPath, value).suffix(".out"));
          } else {
            // The key contains the correct label of the data. The value contains a prediction
            ofile.writeChars(value); // write the prediction
            ofile.writeChar('\n');

            resList.add(new double[]{key, Double.valueOf(value)});
          }
        }
      } finally {
View Full Code Here

        Instance instance = converter.convert(line);
        double prediction = forest.classify(dataset, rng, instance);

        if (ofile != null) {
          ofile.writeChars(Double.toString(prediction)); // write the prediction
          ofile.writeChar('\n');
        }
       
        results.add(new double[] {dataset.getLabel(instance), prediction});
      }
View Full Code Here

    fs.createNewFile(FROM);

    FSDataOutputStream output = fs.create(FROM, true);
    for(int i = 0; i < 100; ++i) {
        output.writeInt(i);
        output.writeChar('\n');
    }
    output.close();
    fs.setTimes(FROM, MODIFICATION_TIME, 0);
    fs.setPermission(FROM, PERMISSIONS);
  }
View Full Code Here

  public void testOutputStreamClosedTwice() throws IOException {
    //HADOOP-4760 according to Closeable#close() closing already-closed
    //streams should have no effect.
    Path src = path("/test/hadoop/file");
    FSDataOutputStream out = fs.create(src);
    out.writeChar('H'); //write some data
    out.close();
    out.close();
  }
 
  protected Path path(String pathString) {
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.