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.blm.orc.OrcSplit.java

License:Apache License

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

    int flags = (hasBase ? BASE_FLAG : 0) | (isOriginal ? ORIGINAL_FLAG : 0) | (hasFooter ? FOOTER_FLAG : 0);
    out.writeByte(flags);/* w  ww. j a v a  2s  .co  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());
    }
}

From source file:com.chinamobile.bcbsp.action.KillJobAction.java

License:Apache License

@Override
public void write(DataOutput out) throws IOException {
    Text.writeString(out, jobId);
}

From source file:com.chinamobile.bcbsp.bspcontroller.Counters.java

License:Apache License

@Override
public synchronized void write(DataOutput out) throws IOException {
    out.writeInt(counters.size());//from w w w. ja va 2  s  .c om
    for (Group group : counters.values()) {
        Text.writeString(out, group.getName());
        group.write(out);
    }
}

From source file:com.chinamobile.bcbsp.bspstaff.BSPStaff.java

License:Apache License

/** Write and read split info to WorkerManager. */
@Override//from   ww  w. j  av  a  2s.  co m
public void write(DataOutput out) throws IOException {
    super.write(out);
    Text.writeString(out, rawSplitClass);
    rawSplit.write(out);
}

From source file:com.chinamobile.bcbsp.bspstaff.Staff.java

License:Apache License

@Override
public void write(DataOutput out) throws IOException {
    getJobId().write(out);/*ww  w .j  av  a 2 s  . c o  m*/
    Text.writeString(out, jobFile);
    sid.write(out);
    out.writeInt(partition);
    out.writeInt(this.failCounter);
    Text.writeString(out, jobExeLocalPath);
}

From source file:com.chinamobile.bcbsp.examples.StringEdge.java

License:Apache License

/**
 * Serialize vertexID and edgeValue.// w  w  w .j ava 2 s .c  o  m
 * @param out vertexID or edgeValue
 */
@Override
public void write(DataOutput out) throws IOException {
    Text.writeString(out, this.vertexID);
    Text.writeString(out, this.edgeValue);
}

From source file:com.chinamobile.bcbsp.examples.StringVertex.java

License:Apache License

/**
 * Serialize vertexID and edgeValue,edgesList
 * @param out//w w w .j av  a2  s .c  o  m
 *        vertexID or edgeValue
 */
@Override
public void write(DataOutput out) throws IOException {
    Text.writeString(out, this.vertexID);
    Text.writeString(out, this.vertexValue);
    out.writeInt(this.edgesList.size());
    for (StringEdge edge : edgesList) {
        edge.write(out);
    }
}

From source file:com.chinamobile.bcbsp.fault.storage.Fault.java

License:Apache License

/**
 * write fault information./*  w w w .j a v  a2s .com*/
 * @param out
 *        data to output.
 */
@Override
public void write(DataOutput out) throws IOException {
    WritableUtils.writeEnum(out, this.type);
    WritableUtils.writeEnum(out, this.level);
    Text.writeString(out, this.timeOfFailure);
    Text.writeString(out, this.workerNodeName);
    Text.writeString(out, this.jobName);
    Text.writeString(out, this.staffName);
    Text.writeString(out, this.exceptionMessage);
    out.writeInt(this.superStep_Stage);
}

From source file:com.chinamobile.bcbsp.pipes.BinaryProtocol.java

License:Apache License

@Override
public void sendMessage(String message) throws IOException {
    // LOG.info("the message is " + message);
    Text.writeString(outPutstream, message);
    // LOG.info("Run send messages  command");

}

From source file:com.chinamobile.bcbsp.pipes.BinaryProtocol.java

License:Apache License

@Override
public void sendStaffId(String staffId) throws IOException {
    WritableUtils.writeVInt(outPutstream, MessageType.STAFFID.code);
    LOG.info("the staffid is : " + staffId);
    Text.writeString(outPutstream, staffId);
    LOG.info("Run send staffid command");
    this.flush();
}