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.sf.xrime.algorithms.MST.MSTLabel.MSTMessageTimestampLabel.java

License:Apache License

@Override
public void write(DataOutput out) throws IOException {
    // TODO Auto-generated method stub
    Text.writeString(out, timeStamp);
}

From source file:org.sf.xrime.algorithms.MST.MSTLabel.MSTVertexInforLabel.java

License:Apache License

@Override
public void write(DataOutput out) throws IOException {
    // TODO Auto-generated method stub
    out.writeBoolean(autoWakeUp);/*from w w  w .ja  v a2  s. c  o m*/
    out.writeInt(status);
    Text.writeString(out, fragIdentity);
    out.writeInt(fragLevel);
    Text.writeString(out, bestEdge);
    bestWeight.write(out);
    Text.writeString(out, testEdge);
    Text.writeString(out, inBranch);
    Text.writeString(out, bestEdgeIdentity);
    out.writeInt(findCount);
}

From source file:org.sf.xrime.algorithms.setBFS.SetBFSLabel.java

License:Apache License

@Override
public void write(DataOutput out) throws IOException {
    out.writeInt(status);// w  w w  .ja  va  2 s  .  co  m
    out.writeInt(distance);

    if (preps == null) {
        out.writeInt(0);
        return;
    }

    out.writeInt(preps.size());
    for (String item : preps) {
        Text.writeString(out, item);
    }
}

From source file:org.sf.xrime.model.edge.AdjVertexEdge.java

License:Apache License

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

From source file:org.sf.xrime.model.edge.AdjVertexEdgeWithLabel.java

License:Apache License

@Override
public void write(DataOutput out) throws IOException {
    if (opposite == null) {
        Text.writeString(out, nullString);
    } else {//from   www . j  a va  2  s .c om
        Text.writeString(out, opposite);
    }
    out.writeInt(label);

    //if (label == null){
    //   Text.writeString(out, nullString);
    //}else{
    //   Text.writeString(out, label);
    //}
}

From source file:org.sf.xrime.model.edge.Edge.java

License:Apache License

public void write(DataOutput out) throws IOException {
    if (from == null) {
        Text.writeString(out, nullString);
    } else {//  w w w. j av  a 2  s  .c o m
        Text.writeString(out, from);
    }

    if (to == null) {
        Text.writeString(out, nullString);
    } else {
        Text.writeString(out, to);
    }
}

From source file:org.sf.xrime.model.edge.EdgeSet.java

License:Apache License

@Override
public void write(DataOutput out) throws IOException {
    if (_edges == null || _edges.size() == 0) {
        out.writeInt(0);//  w w w. ja  va  2 s  .c o  m
    } else {
        // Write the number of edges in this set.
        out.writeInt(_edges.size());
        // All the edges should have the same type.
        Text.writeString(out, _edges.toArray()[0].getClass().getName());
        for (Edge edge : _edges) {
            edge.write(out);
        }
    }
}

From source file:org.sf.xrime.model.label.Labels.java

License:Apache License

@Override
public void write(DataOutput out) throws IOException {
    if (labels == null) {
        out.writeInt(0);/*from  w  w w .  j a  v a 2 s .  c o  m*/
        return;
    }

    out.writeInt(labels.size());
    for (String key : labels.keySet()) {
        Text.writeString(out, key);
        Writable value = labels.get(key);
        Text.writeString(out, value.getClass().getName());
        value.write(out);
    }
}

From source file:org.sf.xrime.model.path.PathAsVertexesList.java

License:Apache License

@Override
public void write(DataOutput out) throws IOException {
    if (_vertexes == null || _vertexes.size() == 0) {
        out.writeInt(0);//www  . j a  v a 2  s  .c  o m
    } else {
        // Write the number of vertexes in this set.
        out.writeInt(_vertexes.size());
        // All the vertexes should have the same type.
        Text.writeString(out, _vertexes.toArray()[0].getClass().getName());
        for (int i = 0; i < _vertexes.size(); i++) {
            _vertexes.get(i).write(out);
        }
    }
}

From source file:org.sf.xrime.model.vertex.AdjBiSetVertex.java

License:Apache License

@Override
public void write(DataOutput out) throws IOException {
    // Write the pure vertex id.
    super.write(out);
    // Deal with the forward and backward vertexes sets.
    if (_forward_vertexes == null || _forward_vertexes.size() == 0) {
        out.writeInt(0);//  ww  w .j  a  va2 s .com
    } else {
        out.writeInt(_forward_vertexes.size());
        Text.writeString(out, _forward_vertexes.toArray()[0].getClass().getName());
        for (AdjVertexEdge edge : _forward_vertexes) {
            edge.write(out);
        }
    }
    if (_backward_vertexes == null || _backward_vertexes.size() == 0) {
        out.writeInt(0);
    } else {
        out.writeInt(_backward_vertexes.size());
        Text.writeString(out, _backward_vertexes.toArray()[0].getClass().getName());
        for (AdjVertexEdge edge : _backward_vertexes) {
            edge.write(out);
        }
    }
}