Example usage for org.apache.thrift.protocol TProtocol readBinary

List of usage examples for org.apache.thrift.protocol TProtocol readBinary

Introduction

In this page you can find the example usage for org.apache.thrift.protocol TProtocol readBinary.

Prototype

public abstract byte[] readBinary() throws TException;

Source Link

Usage

From source file:backtype.storm.generated.ComponentObject.java

License:Apache License

@Override
protected Object readValue(org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TField field)
        throws org.apache.thrift.TException {
    _Fields setField = _Fields.findByThriftId(field.id);
    if (setField != null) {
        switch (setField) {
        case SERIALIZED_JAVA:
            if (field.type == SERIALIZED_JAVA_FIELD_DESC.type) {
                ByteBuffer serialized_java;
                serialized_java = iprot.readBinary();
                return serialized_java;
            } else {
                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
                return null;
            }// ww  w . ja v a2s.c  om
        case SHELL:
            if (field.type == SHELL_FIELD_DESC.type) {
                ShellComponent shell;
                shell = new ShellComponent();
                shell.read(iprot);
                return shell;
            } else {
                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
                return null;
            }
        case JAVA_OBJECT:
            if (field.type == JAVA_OBJECT_FIELD_DESC.type) {
                JavaObject java_object;
                java_object = new JavaObject();
                java_object.read(iprot);
                return java_object;
            } else {
                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
                return null;
            }
        default:
            throw new IllegalStateException(
                    "setField wasn't null, but didn't match any of the case statements!");
        }
    } else {
        org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
        return null;
    }
}

From source file:backtype.storm.generated.Grouping.java

License:Apache License

@Override
protected Object readValue(org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TField field)
        throws org.apache.thrift.TException {
    _Fields setField = _Fields.findByThriftId(field.id);
    if (setField != null) {
        switch (setField) {
        case FIELDS:
            if (field.type == FIELDS_FIELD_DESC.type) {
                List<String> fields;
                {//from   ww w .  j a  va2  s.  c  o m
                    org.apache.thrift.protocol.TList _list4 = iprot.readListBegin();
                    fields = new ArrayList<String>(_list4.size);
                    for (int _i5 = 0; _i5 < _list4.size; ++_i5) {
                        String _elem6; // required
                        _elem6 = iprot.readString();
                        fields.add(_elem6);
                    }
                    iprot.readListEnd();
                }
                return fields;
            } else {
                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
                return null;
            }
        case SHUFFLE:
            if (field.type == SHUFFLE_FIELD_DESC.type) {
                NullStruct shuffle;
                shuffle = new NullStruct();
                shuffle.read(iprot);
                return shuffle;
            } else {
                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
                return null;
            }
        case ALL:
            if (field.type == ALL_FIELD_DESC.type) {
                NullStruct all;
                all = new NullStruct();
                all.read(iprot);
                return all;
            } else {
                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
                return null;
            }
        case NONE:
            if (field.type == NONE_FIELD_DESC.type) {
                NullStruct none;
                none = new NullStruct();
                none.read(iprot);
                return none;
            } else {
                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
                return null;
            }
        case DIRECT:
            if (field.type == DIRECT_FIELD_DESC.type) {
                NullStruct direct;
                direct = new NullStruct();
                direct.read(iprot);
                return direct;
            } else {
                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
                return null;
            }
        case CUSTOM_OBJECT:
            if (field.type == CUSTOM_OBJECT_FIELD_DESC.type) {
                JavaObject custom_object;
                custom_object = new JavaObject();
                custom_object.read(iprot);
                return custom_object;
            } else {
                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
                return null;
            }
        case CUSTOM_SERIALIZED:
            if (field.type == CUSTOM_SERIALIZED_FIELD_DESC.type) {
                ByteBuffer custom_serialized;
                custom_serialized = iprot.readBinary();
                return custom_serialized;
            } else {
                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
                return null;
            }
        case LOCAL_OR_SHUFFLE:
            if (field.type == LOCAL_OR_SHUFFLE_FIELD_DESC.type) {
                NullStruct local_or_shuffle;
                local_or_shuffle = new NullStruct();
                local_or_shuffle.read(iprot);
                return local_or_shuffle;
            } else {
                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
                return null;
            }
        default:
            throw new IllegalStateException(
                    "setField wasn't null, but didn't match any of the case statements!");
        }
    } else {
        org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
        return null;
    }
}

From source file:backtype.storm.generated.HBMessageData.java

License:Apache License

@Override
protected Object standardSchemeReadValue(org.apache.thrift.protocol.TProtocol iprot,
        org.apache.thrift.protocol.TField field) throws org.apache.thrift.TException {
    _Fields setField = _Fields.findByThriftId(field.id);
    if (setField != null) {
        switch (setField) {
        case PATH:
            if (field.type == PATH_FIELD_DESC.type) {
                String path;//from  w  w  w .ja v a2  s  .c om
                path = iprot.readString();
                return path;
            } else {
                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
                return null;
            }
        case PULSE:
            if (field.type == PULSE_FIELD_DESC.type) {
                HBPulse pulse;
                pulse = new HBPulse();
                pulse.read(iprot);
                return pulse;
            } else {
                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
                return null;
            }
        case BOOLVAL:
            if (field.type == BOOLVAL_FIELD_DESC.type) {
                Boolean boolval;
                boolval = iprot.readBool();
                return boolval;
            } else {
                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
                return null;
            }
        case RECORDS:
            if (field.type == RECORDS_FIELD_DESC.type) {
                HBRecords records;
                records = new HBRecords();
                records.read(iprot);
                return records;
            } else {
                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
                return null;
            }
        case NODES:
            if (field.type == NODES_FIELD_DESC.type) {
                HBNodes nodes;
                nodes = new HBNodes();
                nodes.read(iprot);
                return nodes;
            } else {
                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
                return null;
            }
        case MESSAGE_BLOB:
            if (field.type == MESSAGE_BLOB_FIELD_DESC.type) {
                ByteBuffer message_blob;
                message_blob = iprot.readBinary();
                return message_blob;
            } else {
                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
                return null;
            }
        default:
            throw new IllegalStateException(
                    "setField wasn't null, but didn't match any of the case statements!");
        }
    } else {
        org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
        return null;
    }
}

From source file:backtype.storm.generated.HBMessageData.java

License:Apache License

@Override
protected Object tupleSchemeReadValue(org.apache.thrift.protocol.TProtocol iprot, short fieldID)
        throws org.apache.thrift.TException {
    _Fields setField = _Fields.findByThriftId(fieldID);
    if (setField != null) {
        switch (setField) {
        case PATH:
            String path;//from w ww  .  j av a 2s. c o m
            path = iprot.readString();
            return path;
        case PULSE:
            HBPulse pulse;
            pulse = new HBPulse();
            pulse.read(iprot);
            return pulse;
        case BOOLVAL:
            Boolean boolval;
            boolval = iprot.readBool();
            return boolval;
        case RECORDS:
            HBRecords records;
            records = new HBRecords();
            records.read(iprot);
            return records;
        case NODES:
            HBNodes nodes;
            nodes = new HBNodes();
            nodes.read(iprot);
            return nodes;
        case MESSAGE_BLOB:
            ByteBuffer message_blob;
            message_blob = iprot.readBinary();
            return message_blob;
        default:
            throw new IllegalStateException(
                    "setField wasn't null, but didn't match any of the case statements!");
        }
    } else {
        throw new TProtocolException("Couldn't find a field with field id " + fieldID);
    }
}

From source file:backtype.storm.generated.JavaObjectArg.java

License:Apache License

@Override
protected Object readValue(org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TField field)
        throws org.apache.thrift.TException {
    _Fields setField = _Fields.findByThriftId(field.id);
    if (setField != null) {
        switch (setField) {
        case INT_ARG:
            if (field.type == INT_ARG_FIELD_DESC.type) {
                Integer int_arg;
                int_arg = iprot.readI32();
                return int_arg;
            } else {
                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
                return null;
            }//from   w w w .  j  a v  a 2  s  .c o  m
        case LONG_ARG:
            if (field.type == LONG_ARG_FIELD_DESC.type) {
                Long long_arg;
                long_arg = iprot.readI64();
                return long_arg;
            } else {
                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
                return null;
            }
        case STRING_ARG:
            if (field.type == STRING_ARG_FIELD_DESC.type) {
                String string_arg;
                string_arg = iprot.readString();
                return string_arg;
            } else {
                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
                return null;
            }
        case BOOL_ARG:
            if (field.type == BOOL_ARG_FIELD_DESC.type) {
                Boolean bool_arg;
                bool_arg = iprot.readBool();
                return bool_arg;
            } else {
                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
                return null;
            }
        case BINARY_ARG:
            if (field.type == BINARY_ARG_FIELD_DESC.type) {
                ByteBuffer binary_arg;
                binary_arg = iprot.readBinary();
                return binary_arg;
            } else {
                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
                return null;
            }
        case DOUBLE_ARG:
            if (field.type == DOUBLE_ARG_FIELD_DESC.type) {
                Double double_arg;
                double_arg = iprot.readDouble();
                return double_arg;
            } else {
                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
                return null;
            }
        default:
            throw new IllegalStateException(
                    "setField wasn't null, but didn't match any of the case statements!");
        }
    } else {
        org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
        return null;
    }
}

From source file:com.bigdata.dastor.thrift.Column.java

License:Apache License

public void read(TProtocol iprot) throws TException {
    TField field;/*w  ww  .ja  v a2  s.  c om*/
    iprot.readStructBegin();
    while (true) {
        field = iprot.readFieldBegin();
        if (field.type == TType.STOP) {
            break;
        }
        switch (field.id) {
        case 1: // NAME
            if (field.type == TType.STRING) {
                this.name = iprot.readBinary();
            } else {
                TProtocolUtil.skip(iprot, field.type);
            }
            break;
        case 2: // VALUE
            if (field.type == TType.STRING) {
                this.value = iprot.readBinary();
            } else {
                TProtocolUtil.skip(iprot, field.type);
            }
            break;
        case 3: // TIMESTAMP
            if (field.type == TType.I64) {
                this.timestamp = iprot.readI64();
                setTimestampIsSet(true);
            } else {
                TProtocolUtil.skip(iprot, field.type);
            }
            break;
        default:
            TProtocolUtil.skip(iprot, field.type);
        }
        iprot.readFieldEnd();
    }
    iprot.readStructEnd();

    // check for required fields of primitive type, which can't be checked in the validate method
    if (!isSetTimestamp()) {
        throw new TProtocolException(
                "Required field 'timestamp' was not found in serialized data! Struct: " + toString());
    }
    validate();
}

From source file:com.bigdata.dastor.thrift.ColumnParent.java

License:Apache License

public void read(TProtocol iprot) throws TException {
    TField field;//w  ww  .  j a v a2  s .co m
    iprot.readStructBegin();
    while (true) {
        field = iprot.readFieldBegin();
        if (field.type == TType.STOP) {
            break;
        }
        switch (field.id) {
        case 3: // COLUMN_FAMILY
            if (field.type == TType.STRING) {
                this.column_family = iprot.readString();
            } else {
                TProtocolUtil.skip(iprot, field.type);
            }
            break;
        case 4: // SUPER_COLUMN
            if (field.type == TType.STRING) {
                this.super_column = iprot.readBinary();
            } else {
                TProtocolUtil.skip(iprot, field.type);
            }
            break;
        default:
            TProtocolUtil.skip(iprot, field.type);
        }
        iprot.readFieldEnd();
    }
    iprot.readStructEnd();

    // check for required fields of primitive type, which can't be checked in the validate method
    validate();
}

From source file:com.bigdata.dastor.thrift.ColumnPath.java

License:Apache License

public void read(TProtocol iprot) throws TException {
    TField field;//from ww w. j  a va 2 s .  c  o  m
    iprot.readStructBegin();
    while (true) {
        field = iprot.readFieldBegin();
        if (field.type == TType.STOP) {
            break;
        }
        switch (field.id) {
        case 3: // COLUMN_FAMILY
            if (field.type == TType.STRING) {
                this.column_family = iprot.readString();
            } else {
                TProtocolUtil.skip(iprot, field.type);
            }
            break;
        case 4: // SUPER_COLUMN
            if (field.type == TType.STRING) {
                this.super_column = iprot.readBinary();
            } else {
                TProtocolUtil.skip(iprot, field.type);
            }
            break;
        case 5: // COLUMN
            if (field.type == TType.STRING) {
                this.column = iprot.readBinary();
            } else {
                TProtocolUtil.skip(iprot, field.type);
            }
            break;
        default:
            TProtocolUtil.skip(iprot, field.type);
        }
        iprot.readFieldEnd();
    }
    iprot.readStructEnd();

    // check for required fields of primitive type, which can't be checked in the validate method
    validate();
}

From source file:com.bigdata.dastor.thrift.Deletion.java

License:Apache License

public void read(TProtocol iprot) throws TException {
    TField field;/*from ww w  .j  av a  2 s . c o  m*/
    iprot.readStructBegin();
    while (true) {
        field = iprot.readFieldBegin();
        if (field.type == TType.STOP) {
            break;
        }
        switch (field.id) {
        case 1: // TIMESTAMP
            if (field.type == TType.I64) {
                this.timestamp = iprot.readI64();
                setTimestampIsSet(true);
            } else {
                TProtocolUtil.skip(iprot, field.type);
            }
            break;
        case 2: // SUPER_COLUMN
            if (field.type == TType.STRING) {
                this.super_column = iprot.readBinary();
            } else {
                TProtocolUtil.skip(iprot, field.type);
            }
            break;
        case 3: // PREDICATE
            if (field.type == TType.STRUCT) {
                this.predicate = new SlicePredicate();
                this.predicate.read(iprot);
            } else {
                TProtocolUtil.skip(iprot, field.type);
            }
            break;
        default:
            TProtocolUtil.skip(iprot, field.type);
        }
        iprot.readFieldEnd();
    }
    iprot.readStructEnd();

    // check for required fields of primitive type, which can't be checked in the validate method
    if (!isSetTimestamp()) {
        throw new TProtocolException(
                "Required field 'timestamp' was not found in serialized data! Struct: " + toString());
    }
    validate();
}

From source file:com.bigdata.dastor.thrift.SlicePredicate.java

License:Apache License

public void read(TProtocol iprot) throws TException {
    TField field;//  ww w . j av a  2 s .com
    iprot.readStructBegin();
    while (true) {
        field = iprot.readFieldBegin();
        if (field.type == TType.STOP) {
            break;
        }
        switch (field.id) {
        case 1: // COLUMN_NAMES
            if (field.type == TType.LIST) {
                {
                    TList _list4 = iprot.readListBegin();
                    this.column_names = new ArrayList<byte[]>(_list4.size);
                    for (int _i5 = 0; _i5 < _list4.size; ++_i5) {
                        byte[] _elem6;
                        _elem6 = iprot.readBinary();
                        this.column_names.add(_elem6);
                    }
                    iprot.readListEnd();
                }
            } else {
                TProtocolUtil.skip(iprot, field.type);
            }
            break;
        case 2: // SLICE_RANGE
            if (field.type == TType.STRUCT) {
                this.slice_range = new SliceRange();
                this.slice_range.read(iprot);
            } else {
                TProtocolUtil.skip(iprot, field.type);
            }
            break;
        default:
            TProtocolUtil.skip(iprot, field.type);
        }
        iprot.readFieldEnd();
    }
    iprot.readStructEnd();

    // check for required fields of primitive type, which can't be checked in the validate method
    validate();
}