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

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

Introduction

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

Prototype

@Override
public void readFields(DataInput in) throws IOException 

Source Link

Document

deserialize

Usage

From source file:it.uniroma1.bdc.tesi.piccioli.giraphstandalone.message.CustomMessageWithPath.java

@Override
public void readFields(DataInput in) throws IOException {

    int size = in.readInt();
    visitedVertex = new HashSet<Text>();
    for (int i = 0; i < size; i++) {
        Text toAdd = new Text();
        toAdd.readFields(in);
        visitedVertex.add(toAdd);/*from   www . j a va  2  s.c  o m*/
    }
    sourceVertex.readFields(in);
}

From source file:net.darkseraphim.webanalytics.hadoop.csv.Row.java

License:Apache License

public void readFields(DataInput datainput) throws IOException {
    this.clear();
    int count = datainput.readInt();
    for (int i = 0; i < count; i++) {
        try {// www  .j  a  va 2  s .  c om
            Text obj = Text.class.newInstance();
            obj.readFields(datainput);
            this.add(obj);
        } catch (InstantiationException e) {
            throw new IOException(e);
        } catch (IllegalAccessException e) {
            throw new IOException(e);
        }
    }
}

From source file:nl.bioinf.wvanhelvoirt.HadoopPhredCalculator.TextArrayWritable.java

License:Open Source License

/**
 * Method that reads the fields in this custom Writable to be used after serialization.
 *
 * @param in DataInput which will be set in a new Text array.
 * @throws IOException Returns default error.
 *//*from ww  w  . jav a  2s . co m*/
public void readFields(DataInput in) throws IOException {

    // Construct the Text array, the values and add them to the Text array.
    this.values = new Text[in.readInt()];
    for (int i = 0; i < this.values.length; i++) {
        Text value;
        try {
            value = (Text) this.valueClass.newInstance();
        } catch (InstantiationException | IllegalAccessException e) {
            throw new RuntimeException(e.toString());
        }
        value.readFields(in);
        this.values[i] = value;
    }
}

From source file:org.acaro.graffiti.processing.ResultSet.java

License:Apache License

@Override
public void readFields(DataInput input) throws IOException {

    int n = input.readInt();
    for (int i = 0; i < n; i++) {
        Text t = new Text();
        t.readFields(input);
        results.add(t);//from  www .  j  av a 2  s . c  o m
    }
}

From source file:org.acaro.graffiti.processing.Vertex.java

License:Apache License

@Override
public void readFields(DataInput in) throws IOException {

    vertexId = new Text();
    vertexId.readFields(in);/*  w ww  .  j  a  v a 2 s .  c  o m*/

    int edgeMapSize = in.readInt();
    for (int i = 0; i < edgeMapSize; i++) {
        Text label = new Text();
        label.readFields(in);
        int verticesSize = in.readInt();
        for (int j = 0; j < verticesSize; j++) {
            Text vID = new Text();
            vID.readFields(in);
            addEdge(vID, label);
        }
    }

    int msgListSize = in.readInt();
    for (int i = 0; i < msgListSize; i++) {
        Message msg = new Message();
        msg.readFields(in);
        msgList.add(msg);
    }

    halt = in.readBoolean();
}

From source file:org.apache.accumulo.core.client.mapreduce.InputTableConfig.java

License:Apache License

@Override
public void readFields(DataInput dataInput) throws IOException {
    // load iterators
    long iterSize = dataInput.readInt();
    if (iterSize > 0)
        iterators = new ArrayList<>();
    for (int i = 0; i < iterSize; i++)
        iterators.add(new IteratorSetting(dataInput));
    // load ranges
    long rangeSize = dataInput.readInt();
    if (rangeSize > 0)
        ranges = new ArrayList<>();
    for (int i = 0; i < rangeSize; i++) {
        Range range = new Range();
        range.readFields(dataInput);// w  w  w. j  a  v a  2  s  .  c om
        ranges.add(range);
    }
    // load columns
    long columnSize = dataInput.readInt();
    if (columnSize > 0)
        columns = new HashSet<>();
    for (int i = 0; i < columnSize; i++) {
        long numPairs = dataInput.readInt();
        Text colFam = new Text();
        colFam.readFields(dataInput);
        if (numPairs == 1) {
            columns.add(new Pair<Text, Text>(colFam, null));
        } else if (numPairs == 2) {
            Text colQual = new Text();
            colQual.readFields(dataInput);
            columns.add(new Pair<>(colFam, colQual));
        }
    }
    autoAdjustRanges = dataInput.readBoolean();
    useLocalIterators = dataInput.readBoolean();
    useIsolatedScanners = dataInput.readBoolean();
    offlineScan = dataInput.readBoolean();
}

From source file:org.apache.accumulo.core.conf.TableQueryConfig.java

License:Apache License

@Override
public void readFields(DataInput dataInput) throws IOException {
    this.tableName = dataInput.readUTF();
    // load iterators
    long iterSize = dataInput.readInt();
    if (iterSize > 0)
        iterators = new ArrayList<IteratorSetting>();
    for (int i = 0; i < iterSize; i++)
        iterators.add(new IteratorSetting(dataInput));
    // load ranges
    long rangeSize = dataInput.readInt();
    if (rangeSize > 0)
        ranges = new ArrayList<Range>();
    for (int i = 0; i < rangeSize; i++) {
        Range range = new Range();
        range.readFields(dataInput);/*from  w  ww.jav a  2s. co m*/
        ranges.add(range);
    }
    // load columns
    long columnSize = dataInput.readInt();
    if (columnSize > 0)
        columns = new HashSet<Pair<Text, Text>>();
    for (int i = 0; i < columnSize; i++) {
        long numPairs = dataInput.readInt();
        Text colFam = new Text();
        colFam.readFields(dataInput);
        if (numPairs == 1) {
            columns.add(new Pair<Text, Text>(colFam, null));
        } else if (numPairs == 2) {
            Text colQual = new Text();
            colQual.readFields(dataInput);
            columns.add(new Pair<Text, Text>(colFam, colQual));
        }
    }
    autoAdjustRanges = dataInput.readBoolean();
    useLocalIterators = dataInput.readBoolean();
    useIsolatedScanners = dataInput.readBoolean();
}

From source file:org.apache.accumulo.core.data.impl.KeyExtent.java

License:Apache License

@Override
public void readFields(DataInput in) throws IOException {
    Text tid = new Text();
    tid.readFields(in);
    setTableId(tid.toString());//from w w w. j  a va  2  s  .  co  m
    boolean hasRow = in.readBoolean();
    if (hasRow) {
        Text er = new Text();
        er.readFields(in);
        setEndRow(er, false, false);
    } else {
        setEndRow(null, false, false);
    }
    boolean hasPrevRow = in.readBoolean();
    if (hasPrevRow) {
        Text per = new Text();
        per.readFields(in);
        setPrevEndRow(per, false, true);
    } else {
        setPrevEndRow((Text) null);
    }

    hashCode = 0;
    check();
}

From source file:org.apache.accumulo.core.dataImpl.KeyExtent.java

License:Apache License

@Override
public void readFields(DataInput in) throws IOException {
    Text tid = new Text();
    tid.readFields(in);
    setTableId(TableId.of(tid.toString()));
    boolean hasRow = in.readBoolean();
    if (hasRow) {
        Text er = new Text();
        er.readFields(in);/*from w w w .  ja v  a 2 s  .  c o  m*/
        setEndRow(er, false, false);
    } else {
        setEndRow(null, false, false);
    }
    boolean hasPrevRow = in.readBoolean();
    if (hasPrevRow) {
        Text per = new Text();
        per.readFields(in);
        setPrevEndRow(per, false, true);
    } else {
        setPrevEndRow(null);
    }

    hashCode = 0;
    check();
}

From source file:org.apache.accumulo.core.summary.SummarySerializer.java

License:Apache License

private static LgSummaries readLGroup(DataInputStream in, String[] symbols) throws IOException {
    String lgroupName = in.readUTF();

    // read first row
    Text firstRow = new Text();
    firstRow.readFields(in);

    // read summaries
    int numSummaries = WritableUtils.readVInt(in);
    SummaryInfo[] summaries = new SummaryInfo[numSummaries];
    for (int i = 0; i < numSummaries; i++) {
        int rowLen = WritableUtils.readVInt(in);
        byte[] row = new byte[rowLen];
        in.readFully(row);/*w  w w . j a v  a2s.c o m*/
        int count = WritableUtils.readVInt(in);
        Map<String, Long> summary = readSummary(in, symbols);
        summaries[i] = new SummaryInfo(row, summary, count);
    }

    return new LgSummaries(firstRow, summaries, lgroupName);
}