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.terrier.structures.indexing.BlockDocumentPostingList.java

License:Mozilla Public License

@Override
public void readFields(DataInput in) throws IOException {
    clear();/*from w  w  w  .j  a va2s.  c  om*/
    final int termCount = WritableUtils.readVInt(in);
    for (int i = 0; i < termCount; i++) {
        final String term = Text.readString(in);
        final int freq = WritableUtils.readVInt(in);
        final int bf = WritableUtils.readVInt(in);
        insert(freq, term);
        if (bf == 0)
            continue;
        final int[] blocks = new int[bf];
        blocks[0] = WritableUtils.readVInt(in) - 1;
        for (int j = 1; j < bf; j++)
            blocks[j] = WritableUtils.readVInt(in) - blocks[j - 1];
        term_blocks.put(term, new TIntHashSet(blocks));
    }
}

From source file:org.terrier.structures.indexing.DocumentPostingList.java

License:Mozilla Public License

public void readFields(DataInput in) throws IOException {
    clear();//from ww w  .j ava 2s.c om
    final int termCount = WritableUtils.readVInt(in);
    for (int i = 0; i < termCount; i++) {
        String term = Text.readString(in);
        int freq = WritableUtils.readVInt(in);
        insert(freq, term);
    }
}

From source file:org.terrier.structures.indexing.singlepass.hadoop.NewSplitEmittedTerm.java

License:Mozilla Public License

/**
 * Read in a Term key object from the input stream 'in'
 *///from www .  j a  v  a2 s  .c  o m
@Override
public void readFields(DataInput in) throws IOException {
    if (USE_HADOOP_TEXT)
        term = Text.readString(in);
    else
        term = in.readUTF();
    splitno = WritableUtils.readVInt(in);
    flushno = WritableUtils.readVInt(in);
}

From source file:org.terrier.structures.indexing.singlepass.hadoop.SplitEmittedTerm.java

License:Mozilla Public License

/**
 * Read in a Term key object from the input stream 'in'
 *//*from   w  w w.  ja  va2 s  .  c  o m*/
public void readFields(DataInput in) throws IOException {
    if (USE_HADOOP_TEXT)
        term = Text.readString(in);
    else
        term = in.readUTF();
    splitno = WritableUtils.readVInt(in);
    flushno = WritableUtils.readVInt(in);
}

From source file:org.vilcek.hive.kv.KVHiveInputSplit.java

License:Apache License

@Override
public void readFields(DataInput in) throws IOException {
    super.readFields(in);
    int nHelperHosts = in.readInt();
    kvHelperHosts = new String[nHelperHosts];
    for (int i = 0; i < nHelperHosts; i++) {
        kvHelperHosts[i] = Text.readString(in);
    }//  w  ww  .  j  ava  2s  . co m

    kvStore = Text.readString(in);
    kvPart = Integer.parseInt(Text.readString(in));
    String dirStr = Text.readString(in);
    if (dirStr == null || dirStr.equals("")) {
        direction = Direction.FORWARD;
    } else {
        direction = Direction.valueOf(dirStr);
    }

    batchSize = in.readInt();

    byte[] pkBytes = readBytes(in);
    if (pkBytes == null) {
        parentKey = null;
    } else {
        parentKey = Key.fromByteArray(pkBytes);
    }

    byte[] srBytes = readBytes(in);
    if (srBytes == null) {
        subRange = null;
    } else {
        subRange = KeyRange.fromByteArray(srBytes);
    }

    String depthStr = Text.readString(in);
    if (depthStr == null || depthStr.equals("")) {
        depth = Depth.PARENT_AND_DESCENDANTS;
    } else {
        depth = Depth.valueOf(depthStr);
    }

    byte[] consBytes = readBytes(in);
    if (consBytes == null) {
        consistency = null;
    } else {
        consistency = Consistency.fromByteArray(consBytes);
    }

    timeout = in.readLong();

    String tuStr = Text.readString(in);
    if (tuStr == null || tuStr.equals("")) {
        timeoutUnit = null;
    } else {
        timeoutUnit = TimeUnit.valueOf(tuStr);
    }

    int len = in.readInt();
    locations = new String[len];
    for (int i = 0; i < len; i++) {
        locations[i] = Text.readString(in);
    }
}

From source file:org.vsw.knowledge.ie.candidate.Candidate.java

License:Open Source License

public void readFields(DataInput in) throws IOException {
    this.source = Text.readString(in);
    this.entity = Text.readString(in);
    this.text = Text.readString(in);
}

From source file:org.wonderbee.elasticsearch.ElasticSearchSplit.java

License:Apache License

@Override
public void readFields(DataInput in) throws IOException {
    shard = in.readInt();//ww  w .j  a v  a2  s .c o  m
    from = in.readLong();
    size = in.readLong();
    host = Text.readString(in);
    nodeName = Text.readString(in);
    tableLocation = Text.readString(in);
}