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

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

Introduction

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

Prototype

public static String readString(DataInput in) throws IOException 

Source Link

Document

Read a UTF8 encoded string from in

Usage

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

License:Apache License

@Override
public void readFields(DataInput in) throws IOException {
    // TODO Auto-generated method stub
    bestWeight.readFields(in);/*from   w  w  w. j  av a  2s  .c  o m*/
    edgeIdentity = Text.readString(in);
}

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

License:Apache License

@Override
public void readFields(DataInput in) throws IOException {
    // TODO Auto-generated method stub
    fragLevel = in.readInt();//from  w w  w. j  a v a2  s .co  m
    fragIdentity = Text.readString(in);
}

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

License:Apache License

@Override
public void readFields(DataInput in) throws IOException {
    // TODO Auto-generated method stub
    timeStamp = Text.readString(in);
}

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

License:Apache License

@Override
public void readFields(DataInput in) throws IOException {
    // TODO Auto-generated method stub
    autoWakeUp = in.readBoolean();//  w  w w . j ava2  s  . c om
    status = in.readInt();
    fragIdentity = Text.readString(in);
    fragLevel = in.readInt();
    bestEdge = Text.readString(in);
    bestWeight.readFields(in);
    testEdge = Text.readString(in);
    inBranch = Text.readString(in);
    bestEdgeIdentity = Text.readString(in);
    findCount = in.readInt();
}

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

License:Apache License

@Override
public void readFields(DataInput in) throws IOException {
    status = in.readInt();/*w  w w. j av a  2 s . c  o  m*/
    distance = in.readInt();

    int size = in.readInt();
    if (preps == null) {
        preps = new ArrayList<String>();
    } else {
        preps.clear();
    }

    for (int ii = 0; ii < size; ii++) {
        String item = Text.readString(in);
        preps.add(item);
    }
}

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

License:Apache License

@Override
public void readFields(DataInput in) throws IOException {
    this.opposite = Text.readString(in);
}

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

License:Apache License

@Override
public void readFields(DataInput in) throws IOException {
    opposite = Text.readString(in);
    if (opposite.length() == 0) {
        opposite = null;// w  w  w  . ja  va  2  s  .  co m
    }
    label = in.readInt();
    //this.label = Text.readString(in);
    //if (label.length() == 0){
    //   label = null;
    //}
}

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

License:Apache License

public void readFields(DataInput in) throws IOException {
    this.from = Text.readString(in);
    if (from.length() == 0) {
        from = null;/*ww w  .  ja va 2s .  co m*/
    }

    this.to = Text.readString(in);
    if (to.length() == 0) {
        to = null;
    }
}

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

License:Apache License

@SuppressWarnings("unchecked")
@Override//  ww  w  . j a  v a  2 s.  c  om
public void readFields(DataInput in) throws IOException {
    // Clear the container.
    _edges.clear();
    // Determine the size.
    int size = in.readInt();
    if (size > 0) {
        // All edges in the set should have the same type.
        String className = Text.readString(in);
        try {
            Class instanceClass;
            instanceClass = Class.forName(className);
            for (int i = 0; i < size; i++) {
                Writable writable = WritableFactories.newInstance(instanceClass, null);
                writable.readFields(in);
                if (writable instanceof Edge) {
                    addEdge((Edge) writable);
                }
            }
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        }
    }
}

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

License:Apache License

@Override
@SuppressWarnings("unchecked")
public void readFields(DataInput in) throws IOException {
    // Clear the container.
    labels.clear();//w w w. j  a  v a  2s  . c o m
    // Determine the size of container.
    int size = in.readInt();
    while (size-- > 0) {
        // Each key is a string, but the label value may be of different types.
        String key = Text.readString(in);
        String valueClassName = Text.readString(in);

        try {
            Class instanceClass;
            instanceClass = Class.forName(valueClassName);
            Writable writable = WritableFactories.newInstance(instanceClass, null);
            writable.readFields(in);
            labels.put(key, writable);
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
            throw new IOException(e.getMessage());
        }
    }
}