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:gaffer.predicate.typevalue.impl.TypeValueInSetPredicate.java

License:Apache License

@Override
public void readFields(DataInput in) throws IOException {
    int size = in.readInt();
    allowedTypeValues = new HashSet<Pair<String>>(size);
    for (int i = 0; i < size; i++) {
        allowedTypeValues.add(new Pair<String>(Text.readString(in), Text.readString(in)));
    }//from  ww  w.ja  v a  2 s  .c  om
}

From source file:gaffer.predicate.typevalue.impl.TypeValueRegularExpressionPredicate.java

License:Apache License

@Override
public void readFields(DataInput in) throws IOException {
    typePattern = Pattern.compile(Text.readString(in));
    valuePattern = Pattern.compile(Text.readString(in));
}

From source file:gaffer.predicate.typevalue.impl.ValueInSetPredicate.java

License:Apache License

@Override
public void readFields(DataInput in) throws IOException {
    int size = in.readInt();
    allowedValues = new HashSet<String>(size);
    for (int i = 0; i < size; i++) {
        allowedValues.add(Text.readString(in));
    }/*from   ww  w  .j a va2  s. co m*/
}

From source file:gaffer.statistics.impl.CappedSetOfStrings.java

License:Apache License

@Override
public void readFields(DataInput in) throws IOException {
    clear();//from   w ww  .j a va  2s  .c  o m
    maxSize = in.readInt();
    full = in.readBoolean();
    if (!full) {
        int setSize = in.readInt();
        for (int i = 0; i < setSize; i++) {
            set.add(Text.readString(in)); // Can add directly to set and bypass size checks as there can't be more strings than maxSize.
        }
    }
}

From source file:gaffer.statistics.impl.MapFromStringToSetOfStrings.java

License:Apache License

@Override
public void readFields(DataInput in) throws IOException {
    int num = in.readInt();
    map.clear();//from  w w  w  .j  av a2s. c  om
    for (int i = 0; i < num; i++) {
        String key = Text.readString(in);
        int size = in.readInt();
        SortedSet<String> set = new TreeSet<String>();
        for (int j = 0; j < size; j++) {
            set.add(Text.readString(in));
        }
        map.put(key, set);
    }
}

From source file:gaffer.statistics.impl.MapOfCounts.java

License:Apache License

@Override
public void readFields(DataInput in) throws IOException {
    int num = in.readInt();
    this.map.clear();
    for (int i = 0; i < num; i++) {
        String s = Text.readString(in);
        this.map.put(s, in.readInt());
    }/*  www  .  ja v a 2s.c  om*/
}

From source file:gaffer.statistics.impl.MapOfLongCounts.java

License:Apache License

@Override
public void readFields(DataInput in) throws IOException {
    long num = in.readInt();
    this.map.clear();
    for (int i = 0; i < num; i++) {
        String s = Text.readString(in);
        this.map.put(s, in.readLong());
    }//w  w  w.  j  a  va 2s  . com
}

From source file:gaffer.statistics.impl.MapOfMinuteBitMaps.java

License:Apache License

@Override
public void readFields(DataInput in) throws IOException {
    int num = in.readInt();
    this.map.clear();
    for (int i = 0; i < num; i++) {
        String s = Text.readString(in);
        MinuteBitMap bitmap = new MinuteBitMap();
        bitmap.readFields(in);// www .j ava 2  s. com
        this.map.put(s, bitmap);
    }
}

From source file:gaffer.statistics.impl.SetOfStrings.java

License:Apache License

@Override
public void readFields(DataInput in) throws IOException {
    clear();//w ww.j  a  v  a  2s. c o  m
    int setSize = in.readInt();
    for (int i = 0; i < setSize; i++) {
        set.add(Text.readString(in));
    }
}

From source file:gaffer.statistics.SetOfStatistics.java

License:Apache License

public void readFields(DataInput in) throws IOException {
    this.nameToStat.clear();
    int numberOfItems = in.readInt();
    for (int i = 0; i < numberOfItems; i++) {
        String key = Text.readString(in);
        nameToStat.put(key, StatisticsUtilities.getStatistic(in));
    }//from  w w  w  .j  a  v a 2s .  c o  m
}