Java Code Examples for org.apache.hadoop.io.LongWritable#write()

The following examples show how to use org.apache.hadoop.io.LongWritable#write() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: WIFIProbe   File: NewOldCustomElement.java    License: Apache License 2.0 5 votes vote down vote up
public void write(DataOutput dataOutput) throws IOException {
    Text text = new Text(wifiProb==null?"":wifiProb);
    text.write(dataOutput);

    LongWritable longWritable = new LongWritable();
    longWritable.set(hour);
    longWritable.write(dataOutput);
    longWritable.set(newCustomer);
    longWritable.write(dataOutput);
    longWritable.set(oldCustomer);
    longWritable.write(dataOutput);

}
 
Example 2
Source Project: tez   File: TestTezMerger.java    License: Apache License 2.0 5 votes vote down vote up
private void populateData(IntWritable intKey, LongWritable longVal, DataInputBuffer key,
    DataInputBuffer value)
    throws  IOException {
  DataOutputBuffer k = new DataOutputBuffer();
  DataOutputBuffer v = new DataOutputBuffer();
  intKey.write(k);
  longVal.write(v);
  key.reset(k.getData(), 0, k.getLength());
  value.reset(v.getData(), 0, v.getLength());
  verificationDataSet.put(intKey.get(), longVal.get());
}
 
Example 3
Source Project: pxf   File: CustomWritable.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public void write(DataOutput out) throws IOException {
    // 0. Timestamp
    Text tms_text = new Text(tms);
    tms_text.write(out);

    // 1. num, int1, int2
    IntWritable intw = new IntWritable();

    for (int i = 0; i < num.length; i++) {
        intw.set(num[i]);
        intw.write(out);
    }

    intw.set(int1);
    intw.write(out);

    intw.set(int2);
    intw.write(out);

    // 2. st1
    Text txt = new Text();

    for (int i = 0; i < strings.length; i++) {
        txt.set(strings[i]);
        txt.write(out);
    }

    txt.set(st1);
    txt.write(out);

    // 3. doubles
    DoubleWritable dw = new DoubleWritable();
    for (int i = 0; i < dubs.length; i++) {
        dw.set(dubs[i]);
        dw.write(out);
    }

    dw.set(db);
    dw.write(out);

    // 4. floats
    FloatWritable fw = new FloatWritable();
    for (int i = 0; i < fts.length; i++) {
        fw.set(fts[i]);
        fw.write(out);
    }

    fw.set(ft);
    fw.write(out);

    // 5. longs
    LongWritable lw = new LongWritable();
    for (int i = 0; i < lngs.length; i++) {
        lw.set(lngs[i]);
        lw.write(out);
    }
    lw.set(lng);
    lw.write(out);

    // 6. booleans
    BooleanWritable bw = new BooleanWritable();
    for (int i = 0; i < bools.length; ++i) {
        bw.set(bools[i]);
        bw.write(out);
    }
    bw.set(bool);
    bw.write(out);

    // 7. shorts
    ShortWritable sw = new ShortWritable();
    for (int i = 0; i < shrts.length; ++i) {
        sw.set(shrts[i]);
        sw.write(out);
    }
    sw.set(shrt);
    sw.write(out);

    // 8. bytes
    // BytesWritable btsw = new BytesWritable(bts);
    // btsw.write(out);
    BytesWritable btsw = new BytesWritable();
    btsw.setCapacity(bts.length);
    btsw.setSize(bts.length);
    btsw.set(bts, 0, bts.length);
    btsw.write(out);
}
 
Example 4
Source Project: hadoop   File: FSImageSerialization.java    License: Apache License 2.0 4 votes vote down vote up
/** write the long value */
static void writeLong(long value, DataOutputStream out) throws IOException {
  LongWritable uLong = TL_DATA.get().U_LONG;
  uLong.set(value);
  uLong.write(out);
}
 
Example 5
Source Project: big-c   File: FSImageSerialization.java    License: Apache License 2.0 4 votes vote down vote up
/** write the long value */
static void writeLong(long value, DataOutputStream out) throws IOException {
  LongWritable uLong = TL_DATA.get().U_LONG;
  uLong.set(value);
  uLong.write(out);
}
 
Example 6
Source Project: RDFS   File: FSImageSerialization.java    License: Apache License 2.0 4 votes vote down vote up
/** write the long value */
static void writeLong(long value, DataOutputStream out) throws IOException {
  LongWritable uLong = TL_DATA.get().U_LONG;
  uLong.set(value);
  uLong.write(out);
}