Example usage for org.apache.hadoop.io Text writeString

List of usage examples for org.apache.hadoop.io Text writeString

Introduction

In this page you can find the example usage for org.apache.hadoop.io Text writeString.

Prototype

public static int writeString(DataOutput out, String s) throws IOException 

Source Link

Document

Write a UTF8 encoded string to out

Usage

From source file:com.aerospike.hadoop.mapreduce.AerospikeSplit.java

License:Apache License

public void write(DataOutput out) throws IOException {
    Text.writeString(out, type);
    Text.writeString(out, node);/*from w  w w .  j a  v a  2 s .  c  o m*/
    Text.writeString(out, host);
    out.writeInt(port);
    Text.writeString(out, namespace);
    Text.writeString(out, setName);
    if (binNames == null) {
        out.writeInt(0);
    } else {
        out.writeInt(binNames.length);
        for (String binName : binNames)
            Text.writeString(out, binName);
    }
    Text.writeString(out, numrangeBin);
    out.writeLong(numrangeBegin);
    out.writeLong(numrangeEnd);
}

From source file:com.ambiata.ivory.operation.hadoop.TaggedInputSplit.java

License:Apache License

@SuppressWarnings("unchecked")
public void write(DataOutput out) throws IOException {
    Text.writeString(out, inputSplitClass.getName());
    Text.writeString(out, inputFormatClass.getName());
    Text.writeString(out, mapperClass.getName());
    SerializationFactory factory = new SerializationFactory(conf);
    Serializer serializer = factory.getSerializer(inputSplitClass);
    serializer.open((DataOutputStream) out);
    serializer.serialize(inputSplit);/*from  w  ww.  j  av  a 2 s . c  o  m*/
}

From source file:com.asakusafw.bridge.hadoop.directio.DirectFileInputSplit.java

License:Apache License

@Override
public void write(DataOutput out) throws IOException {
    Text.writeString(out, containerPath);
    writeFragment(out, fragment);/* w  w w.j a v  a  2 s.c  o  m*/
    writeMap(out, batchArguments);
    writeDataDefinition(out, definition);
}

From source file:com.asakusafw.bridge.hadoop.directio.Util.java

License:Apache License

static void writeDataDefinition(DataOutput out, DataDefinition<?> definition) throws IOException {
    Text.writeString(out, definition.getDataClass().getName());
    Text.writeString(out, definition.getDataFormat().getClass().getName());
    if (definition.getDataFilter() == null) {
        Text.writeString(out, ""); //$NON-NLS-1$
    } else {/*from w  ww .  j  av a  2  s . c o m*/
        Text.writeString(out, definition.getDataFilter().getClass().getName());
    }
}

From source file:com.asakusafw.bridge.hadoop.directio.Util.java

License:Apache License

static void writeMap(DataOutput out, Map<String, String> map) throws IOException {
    if (map == null) {
        WritableUtils.writeVInt(out, 0);
    } else {/*from w  ww .jav a2  s. co  m*/
        WritableUtils.writeVInt(out, map.size());
        for (Map.Entry<String, String> entry : map.entrySet()) {
            Text.writeString(out, entry.getKey());
            Text.writeString(out, entry.getValue());
        }
    }
}

From source file:com.asakusafw.example.direct.seqfile.writable.ItemInfoWritable.java

License:Apache License

@Override
public void write(DataOutput out) throws IOException {
    Text.writeString(out, itemName);
    Text.writeString(out, departmentCode);
    Text.writeString(out, departmentName);
    Text.writeString(out, categoryCode);
    Text.writeString(out, categoryName);
    out.writeInt(unitSellingPrice);//from   ww w .  j  a v  a  2 s.com
    out.writeLong(registeredDate.getTime());
    out.writeLong(beginDate.getTime());
    out.writeLong(endDate.getTime());
}

From source file:com.asakusafw.example.direct.seqfile.writable.SalesDetailWritable.java

License:Apache License

@Override
public void write(DataOutput out) throws IOException {
    out.writeLong(salesDateTime.getTime());
    Text.writeString(out, storeCode);
    Text.writeString(out, itemCode);
    out.writeInt(amount);/*from www. j a v a 2s  .  c  o  m*/
    out.writeInt(unitSellingPrice);
    out.writeInt(sellingPrice);
}

From source file:com.asakusafw.lang.compiler.mapreduce.testing.mock.WritableModelOutput.java

License:Apache License

@Override
public void write(T model) throws IOException {
    if (first) {//w w  w  .j a  v a 2 s.c o  m
        output.writeBoolean(true);
        Text.writeString(output, model.getClass().getName());
        first = false;
    }
    output.writeBoolean(true);
    model.write(output);
}

From source file:com.bah.culvert.constraints.Join.java

License:Apache License

@Override
public void write(DataOutput out) throws IOException {
    // write the left table
    ObjectWritable ow = new ObjectWritable(this.leftTable);
    ow.write(out);/* w  w w .  j  a  v  a2s .  c  o m*/

    // write left constraint
    ow.set(this.left);
    ow.write(out);

    this.leftColumn.write(out);

    Text.writeString(out, this.rightTable);

    // write out the database
    ow.set(this.database);
    ow.write(out);
}

From source file:com.blm.orc.OrcNewSplit.java

License:Apache License

@Override
public void write(DataOutput out) throws IOException {
    //serialize path, offset, length using FileSplit
    super.write(out);

    int flags = (hasBase ? OrcSplit.BASE_FLAG : 0) | (isOriginal ? OrcSplit.ORIGINAL_FLAG : 0)
            | (hasFooter ? OrcSplit.FOOTER_FLAG : 0);
    out.writeByte(flags);/*from  ww w .  j  a v a2 s.  c o  m*/
    out.writeInt(deltas.size());
    for (Long delta : deltas) {
        out.writeLong(delta);
    }
    if (hasFooter) {
        // serialize FileMetaInfo fields
        Text.writeString(out, fileMetaInfo.compressionType);
        WritableUtils.writeVInt(out, fileMetaInfo.bufferSize);
        WritableUtils.writeVInt(out, fileMetaInfo.metadataSize);

        // serialize FileMetaInfo field footer
        ByteBuffer footerBuff = fileMetaInfo.footerBuffer;
        footerBuff.reset();

        // write length of buffer
        WritableUtils.writeVInt(out, footerBuff.limit() - footerBuff.position());
        out.write(footerBuff.array(), footerBuff.position(), footerBuff.limit() - footerBuff.position());
        WritableUtils.writeVInt(out, fileMetaInfo.writerVersion.getId());
    }
}