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:org.apache.gora.util.IOUtils.java

License:Apache License

/**
 * Writes the String array to the given DataOutput.
 * @param out the data output to write to
 * @param arr the array to write/*from w w w  .  j ava 2  s.com*/
 * @see #readStringArray(DataInput)
 */
public static void writeStringArray(DataOutput out, String[] arr) throws IOException {
    WritableUtils.writeVInt(out, arr.length);
    for (String str : arr) {
        Text.writeString(out, str);
    }
}

From source file:org.apache.hama.bsp.BSPTask.java

License:Apache License

@Override
public final void write(DataOutput out) throws IOException {
    super.write(out);
    if (split != null) {
        out.writeBoolean(true);/*  w  w w  .  ja  va2 s. c o  m*/
        Text.writeString(out, splitClass);
        split.write(out);
        split = null;
    } else {
        out.writeBoolean(false);
    }
}

From source file:org.apache.hama.bsp.CombineFileSplit.java

License:Apache License

@Override
public void write(DataOutput out) throws IOException {
    out.writeLong(totLength);/* w ww. jav a  2s . c o  m*/
    out.writeInt(lengths.length);
    for (long length : lengths) {
        out.writeLong(length);
    }
    out.writeInt(paths.length);
    for (Path p : paths) {
        Text.writeString(out, p.toString());
    }
    out.writeInt(startoffset.length);
    for (long length : startoffset) {
        out.writeLong(length);
    }
}

From source file:org.apache.hama.bsp.Counters.java

License:Apache License

/**
 * Write the set of groups. The external format is: #groups (groupName group)*
 * /*from  w  w w.  j av  a  2s. c  om*/
 * i.e. the number of groups followed by 0 or more groups, where each group is
 * of the form:
 * 
 * groupDisplayName #counters (false | true counter)*
 * 
 * where each counter is of the form:
 * 
 * name (false | true displayName) value
 */
@Override
public synchronized void write(DataOutput out) throws IOException {
    out.writeInt(counters.size());
    for (Group group : counters.values()) {
        Text.writeString(out, group.getName());
        group.write(out);
    }
}

From source file:org.apache.hama.bsp.GroomServerStatus.java

License:Apache License

@Override
public void write(DataOutput out) throws IOException {
    Text.writeString(out, groomName);
    Text.writeString(out, rpcServer);
    Text.writeString(out, hostName);

    out.writeInt(failures);// w  ww .  j  a v  a 2  s  .  c  om
    out.writeInt(maxTasks);
    out.writeInt(taskReports.size());
    for (TaskStatus taskStatus : taskReports) {
        taskStatus.write(out);
    }
}

From source file:org.apache.hama.bsp.JobProfile.java

License:Apache License

@Override
public void write(DataOutput out) throws IOException {
    jobid.write(out);/*from ww  w . j  av  a 2  s. c  o m*/
    Text.writeString(out, jobFile);
    Text.writeString(out, user);
    Text.writeString(out, name);
}

From source file:org.apache.hama.bsp.JobStatus.java

License:Apache License

@Override
public synchronized void write(DataOutput out) throws IOException {
    jobid.write(out);/* ww  w  . jav a  2s  .  co m*/
    out.writeLong(setupProgress);
    out.writeLong(progress);
    out.writeLong(cleanupProgress);
    out.writeInt(runState);
    out.writeLong(startTime);
    out.writeLong(finishTime);
    Text.writeString(out, user);
    Text.writeString(out, schedulingInfo);
    out.writeLong(superstepCount);
    counter.write(out);
}

From source file:org.apache.hama.bsp.join.CompositeInputSplit.java

License:Apache License

/**
 * Write splits in the following format.
 * {@code//w  w w .  j  a v  a 2 s . c  om
 * <count><class1><class2>...<classn><split1><split2>...<splitn>
 * }
 */
public void write(DataOutput out) throws IOException {
    WritableUtils.writeVInt(out, splits.length);
    for (InputSplit s : splits) {
        Text.writeString(out, s.getClass().getName());
    }
    for (InputSplit s : splits) {
        s.write(out);
    }
}

From source file:org.apache.hama.bsp.Task.java

License:Apache License

@Override
public void write(DataOutput out) throws IOException {
    jobId.write(out);//from w  w  w .j  a  v a2s  .co m
    Text.writeString(out, jobFile);
    taskId.write(out);
    out.writeInt(partition);
}

From source file:org.apache.hama.bsp.TaskStatus.java

License:Apache License

@Override
public void write(DataOutput out) throws IOException {
    jobId.write(out);/*from w w w.j  a  v a 2  s.  c  om*/
    taskId.write(out);
    out.writeFloat(progress);
    WritableUtils.writeEnum(out, runState);
    Text.writeString(out, stateString);
    WritableUtils.writeEnum(out, phase);
    out.writeLong(startTime);
    out.writeLong(finishTime);

    counters.write(out);
}