Example usage for org.apache.hadoop.io LongWritable write

List of usage examples for org.apache.hadoop.io LongWritable write

Introduction

In this page you can find the example usage for org.apache.hadoop.io LongWritable write.

Prototype

@Override
    public void write(DataOutput out) throws IOException 

Source Link

Usage

From source file:HistogramBucket.java

License:Apache License

@Override
public void write(DataOutput d) throws IOException {
    attribute.write(d);/*from w w w .  j a v  a  2  s  .c  om*/
    LongWritable arraySize = new LongWritable(splits.size());
    arraySize.write(d);
    for (DoubleWritable w : splits) {
        w.write(d);
    }
}

From source file:com.twitter.elephanttwin.io.ListLongWritable.java

License:Apache License

@Override
public void write(DataOutput out) throws IOException {
    out.writeInt(list.size());/*www.java2  s  .c om*/
    Iterator<LongWritable> itr = list.iterator();

    while (itr.hasNext()) {
        LongWritable element = itr.next();
        element.write(out);
    }
}

From source file:it.uniroma1.bdc.tesi.piccioli.giraphstandalone.ksimplecycle.TextValueAndSetPerSuperstep.java

@Override
public void write(DataOutput out) throws IOException {
    int size;/* ww w . ja  v  a2s  .co m*/

    size = this.setPerSuperstep.size();
    out.writeInt(size);//scrivo numero di chiavi nella MAP
    for (LongWritable itemKey : setPerSuperstep.keySet()) {
        itemKey.write(out);//Scrivo chiave 
        this.setPerSuperstep.get(itemKey).write(out);
    }
}

From source file:org.goldenorb.io.checkpoint.CheckPointDataTest.java

License:Apache License

/**
 * Tests the CheckPointDataOutput class by writing several different types of Writables to the checkpoint.
 * /*from   ww w. j  ava2  s .com*/
 * @throws Exception
 */
@Test
public void testCheckpointOutput() throws Exception {

    int superStep = 0;
    int partition = 0;
    OrbConfiguration orbConf = new OrbConfiguration();
    orbConf.set("fs.default.name", "hdfs://localhost:" + cluster.getNameNodePort());
    orbConf.setJobNumber("0");
    orbConf.setFileOutputPath("test");

    CheckPointDataOutput checkpointOutput = new CheckPointDataOutput(orbConf, superStep, partition);

    IntWritable intOutput = new IntWritable(4);
    intOutput.write(checkpointOutput);

    LongWritable longOutput = new LongWritable(9223372036854775807L);
    longOutput.write(checkpointOutput);

    Text textOutput = new Text("test");
    textOutput.write(checkpointOutput);

    FloatWritable floatOutput = new FloatWritable(3.14159F);
    floatOutput.write(checkpointOutput);

    checkpointOutput.close();

    assertThat(checkpointOutput, notNullValue());
}