Example usage for org.apache.hadoop.io WritableUtils readVInt

List of usage examples for org.apache.hadoop.io WritableUtils readVInt

Introduction

In this page you can find the example usage for org.apache.hadoop.io WritableUtils readVInt.

Prototype

public static int readVInt(DataInput stream) throws IOException 

Source Link

Document

Reads a zero-compressed encoded integer from input stream and returns it.

Usage

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

License:Mozilla Public License

@Override
public void readFields(DataInput in) throws IOException {
    clear();/*w  ww  . ja  v  a  2s .  c o m*/
    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 w  w w .  j a v  a2 s  .c  o m*/
    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'
 *//*w w w .j  a v  a  2 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 www  .j  a  va2s .  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.terrier.structures.postings.BasicPostingImpl.java

License:Mozilla Public License

/** Reads the a single posting (not an iterable posting - use BitPostingIndex for that) */
public void readFields(DataInput in) throws IOException {
    id = WritableUtils.readVInt(in);
    tf = WritableUtils.readVInt(in);/*from   w  ww  .j  a  v  a 2s. c o m*/
}

From source file:org.terrier.structures.postings.bit.BlockFieldIterablePosting.java

License:Mozilla Public License

/** {@inheritDoc} */
@Override/*from   w w w  .j a  v a2  s . com*/
public void readFields(DataInput in) throws IOException {
    super.readFields(in);
    final int blockCount = WritableUtils.readVInt(in);
    final int l = in.readInt();
    for (int i = 0; i < l; i++)
        fieldFrequencies[i] = in.readInt();
    positions = new int[blockCount];
    for (int i = 0; i < blockCount; i++)
        positions[i] = WritableUtils.readVInt(in);
}

From source file:org.terrier.structures.postings.bit.BlockIterablePosting.java

License:Mozilla Public License

@Override
public void readFields(DataInput in) throws IOException {
    super.readFields(in);
    final int blockCount = WritableUtils.readVInt(in);
    positions = new int[blockCount];
    for (int i = 0; i < blockCount; i++)
        positions[i] = WritableUtils.readVInt(in);
}

From source file:org.terrier.structures.postings.bit.FieldIterablePosting.java

License:Mozilla Public License

/** Read this posting from specified inputstream */
@Override/*from w w w. j  a  va2 s  .  c  o  m*/
public void readFields(DataInput in) throws IOException {
    super.readFields(in);
    final int l = WritableUtils.readVInt(in);
    //fieldFrequencies = new int[l];
    for (int i = 0; i < l; i++)
        fieldFrequencies[i] = WritableUtils.readVInt(in);
}

From source file:org.terrier.structures.postings.BlockFieldPostingImpl.java

License:Mozilla Public License

@Override
public void readFields(DataInput in) throws IOException {
    super.readFields(in);
    final int l = WritableUtils.readVInt(in);
    fieldFrequencies = new int[l];
    for (int i = 0; i < l; i++)
        fieldFrequencies[i] = WritableUtils.readVInt(in);
}

From source file:org.terrier.structures.postings.BlockPostingImpl.java

License:Mozilla Public License

/** {@inheritDoc} */
@Override/* w w  w .  ja  v  a2s. c  om*/
public void readFields(DataInput in) throws IOException {
    super.readFields(in);
    final int blockCount = WritableUtils.readVInt(in);
    positions = new int[blockCount];
    for (int i = 0; i < blockCount; i++)
        positions[i] = WritableUtils.readVInt(in);
}