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.CombinedPredicates.java

License:Apache License

@Override
public void readFields(DataInput in) throws IOException {
    try {// w w w  .j  a  v a2  s. c o m
        String className1 = Text.readString(in);
        predicate1 = (Predicate<T>) Class.forName(className1).newInstance();
        predicate1.readFields(in);
        String className2 = Text.readString(in);
        predicate2 = (Predicate<T>) Class.forName(className2).newInstance();
        predicate2.readFields(in);
    } catch (InstantiationException e) {
        throw new IOException("Exception deserialising predicate in " + this.getClass().getName() + ": " + e);
    } catch (IllegalAccessException e) {
        throw new IOException("Exception deserialising predicate in " + this.getClass().getName() + ": " + e);
    } catch (ClassNotFoundException e) {
        throw new IOException("Exception deserialising predicate in " + this.getClass().getName() + ": " + e);
    } catch (ClassCastException e) {
        throw new IOException("Exception deserialising predicate in " + this.getClass().getName() + ": " + e);
    }
    combine = Combine.values()[in.readInt()];
}

From source file:gaffer.predicate.NotPredicate.java

License:Apache License

@Override
public void readFields(DataInput in) throws IOException {
    try {//from  w  w  w . j  a  va  2  s. c o m
        String className = Text.readString(in);
        predicate = (Predicate<T>) Class.forName(className).newInstance();
        predicate.readFields(in);
    } catch (InstantiationException e) {
        throw new IOException("Exception deserialising predicate in " + this.getClass().getName() + ": " + e);
    } catch (IllegalAccessException e) {
        throw new IOException("Exception deserialising predicate in " + this.getClass().getName() + ": " + e);
    } catch (ClassNotFoundException e) {
        throw new IOException("Exception deserialising predicate in " + this.getClass().getName() + ": " + e);
    } catch (ClassCastException e) {
        throw new IOException("Exception deserialising predicate in " + this.getClass().getName() + ": " + e);
    }
}

From source file:gaffer.predicate.summarytype.impl.CombinedPredicates.java

License:Apache License

@Override
public void readFields(DataInput in) throws IOException {
    try {/*from   w  w w. j a  v  a  2 s  . com*/
        String predicate1ClassName = Text.readString(in);
        predicate1 = (SummaryTypePredicate) Class.forName(predicate1ClassName).newInstance();
        predicate1.readFields(in);
        String predicate2ClassName = Text.readString(in);
        predicate2 = (SummaryTypePredicate) Class.forName(predicate2ClassName).newInstance();
        predicate2.readFields(in);
    } catch (InstantiationException e) {
        throw new IOException("Unable to deserialise CombinedPredicates: " + e);
    } catch (IllegalAccessException e) {
        throw new IOException("Unable to deserialise CombinedPredicates: " + e);
    } catch (ClassNotFoundException e) {
        throw new IOException("Unable to deserialise CombinedPredicates: " + e);
    } catch (ClassCastException e) {
        throw new IOException("Unable to deserialise CombinedPredicates: " + e);
    }
    combine = Combine.values()[in.readInt()];
}

From source file:gaffer.predicate.summarytype.impl.NotPredicate.java

License:Apache License

@Override
public void readFields(DataInput in) throws IOException {
    try {//  ww  w . j a  va2s. co  m
        String predicate1ClassName = Text.readString(in);
        predicate = (SummaryTypePredicate) Class.forName(predicate1ClassName).newInstance();
        predicate.readFields(in);
    } catch (InstantiationException e) {
        throw new IOException("Unable to deserialise NotPredicate: " + e);
    } catch (IllegalAccessException e) {
        throw new IOException("Unable to deserialise NotPredicate: " + e);
    } catch (ClassNotFoundException e) {
        throw new IOException("Unable to deserialise NotPredicate: " + e);
    } catch (ClassCastException e) {
        throw new IOException("Unable to deserialise NotPredicate: " + e);
    }
}

From source file:gaffer.predicate.summarytype.impl.RegularExpressionPredicate.java

License:Apache License

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

From source file:gaffer.predicate.summarytype.impl.SummaryTypeAndSubTypeInSetPredicate.java

License:Apache License

@Override
public void readFields(DataInput in) throws IOException {
    int size = in.readInt();
    allowedSummaryTypesAndSubTypes = new HashSet<Pair<String>>(size);
    for (int i = 0; i < size; i++) {
        allowedSummaryTypesAndSubTypes.add(new Pair<String>(Text.readString(in), Text.readString(in)));
    }/*  w w  w  .j av  a2 s.c o  m*/
}

From source file:gaffer.predicate.summarytype.impl.SummaryTypeInSetPredicate.java

License:Apache License

@Override
public void readFields(DataInput in) throws IOException {
    int size = in.readInt();
    allowedSummaryTypes = new HashSet<String>(size);
    for (int i = 0; i < size; i++) {
        allowedSummaryTypes.add(Text.readString(in));
    }/*  ww w .ja v a2s. c  o  m*/
}

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

License:Apache License

@Override
public void readFields(DataInput in) throws IOException {
    try {//from ww w.j ava  2 s  .c  o  m
        String predicate1ClassName = Text.readString(in);
        predicate1 = (TypeValuePredicate) Class.forName(predicate1ClassName).newInstance();
        predicate1.readFields(in);
        String predicate2ClassName = Text.readString(in);
        predicate2 = (TypeValuePredicate) Class.forName(predicate2ClassName).newInstance();
        predicate2.readFields(in);
    } catch (InstantiationException e) {
        throw new IOException("Unable to deserialise CombinedPredicates: " + e);
    } catch (IllegalAccessException e) {
        throw new IOException("Unable to deserialise CombinedPredicates: " + e);
    } catch (ClassNotFoundException e) {
        throw new IOException("Unable to deserialise CombinedPredicates: " + e);
    } catch (ClassCastException e) {
        throw new IOException("Unable to deserialise CombinedPredicates: " + e);
    }
    combine = Combine.values()[in.readInt()];
}

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

License:Apache License

@Override
public void readFields(DataInput in) throws IOException {
    int size = in.readInt();
    allowedTypes = new HashSet<String>(size);
    for (int i = 0; i < size; i++) {
        allowedTypes.add(Text.readString(in));
    }//  w w w.  j  a  va  2s.com
}

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

License:Apache License

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