Example usage for org.apache.thrift.protocol TType STOP

List of usage examples for org.apache.thrift.protocol TType STOP

Introduction

In this page you can find the example usage for org.apache.thrift.protocol TType STOP.

Prototype

byte STOP

To view the source code for org.apache.thrift.protocol TType STOP.

Click Source Link

Usage

From source file:com.ambiata.poacher.mr.TDeserializerCopy.java

License:Apache License

private TField locateField(byte[] bytes, TFieldIdEnum fieldIdPathFirst, TFieldIdEnum... fieldIdPathRest)
        throws TException {
    trans_.reset(bytes);//from ww  w .j  a  v a2  s  . c o  m

    TFieldIdEnum[] fieldIdPath = new TFieldIdEnum[fieldIdPathRest.length + 1];
    fieldIdPath[0] = fieldIdPathFirst;
    for (int i = 0; i < fieldIdPathRest.length; i++) {
        fieldIdPath[i + 1] = fieldIdPathRest[i];
    }

    // index into field ID path being currently searched for
    int curPathIndex = 0;

    // this will be the located field, or null if it is not located
    TField field = null;

    protocol_.readStructBegin();

    while (curPathIndex < fieldIdPath.length) {
        field = protocol_.readFieldBegin();
        // we can stop searching if we either see a stop or we go past the field
        // id we're looking for (since fields should now be serialized in asc
        // order).
        if (field.type == TType.STOP || field.id > fieldIdPath[curPathIndex].getThriftFieldId()) {
            return null;
        }

        if (field.id != fieldIdPath[curPathIndex].getThriftFieldId()) {
            // Not the field we're looking for. Skip field.
            TProtocolUtil.skip(protocol_, field.type);
            protocol_.readFieldEnd();
        } else {
            // This field is the next step in the path. Step into field.
            curPathIndex++;
            if (curPathIndex < fieldIdPath.length) {
                protocol_.readStructBegin();
            }
        }
    }
    return field;
}

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

License:Apache License

public void read(TProtocol iprot) throws TException {
    TField field;// www .j a  v a2 s.co  m
    iprot.readStructBegin();
    while (true) {
        field = iprot.readFieldBegin();
        if (field.type == TType.STOP) {
            break;
        }
        switch (field.id) {
        case 1: // WHY
            if (field.type == TType.STRING) {
                this.why = iprot.readString();
            } 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.AuthenticationRequest.java

License:Apache License

public void read(TProtocol iprot) throws TException {
    TField field;//w w  w .  java 2 s .com
    iprot.readStructBegin();
    while (true) {
        field = iprot.readFieldBegin();
        if (field.type == TType.STOP) {
            break;
        }
        switch (field.id) {
        case 1: // CREDENTIALS
            if (field.type == TType.MAP) {
                {
                    TMap _map16 = iprot.readMapBegin();
                    this.credentials = new HashMap<String, String>(2 * _map16.size);
                    for (int _i17 = 0; _i17 < _map16.size; ++_i17) {
                        String _key18;
                        String _val19;
                        _key18 = iprot.readString();
                        _val19 = iprot.readString();
                        this.credentials.put(_key18, _val19);
                    }
                    iprot.readMapEnd();
                }
            } 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.Column.java

License:Apache License

public void read(TProtocol iprot) throws TException {
    TField field;/* ww  w  .j a  va  2 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.ColumnOrSuperColumn.java

License:Apache License

public void read(TProtocol iprot) throws TException {
    TField field;// ww w  .  ja  va  2s  . co  m
    iprot.readStructBegin();
    while (true) {
        field = iprot.readFieldBegin();
        if (field.type == TType.STOP) {
            break;
        }
        switch (field.id) {
        case 1: // COLUMN
            if (field.type == TType.STRUCT) {
                this.column = new Column();
                this.column.read(iprot);
            } else {
                TProtocolUtil.skip(iprot, field.type);
            }
            break;
        case 2: // SUPER_COLUMN
            if (field.type == TType.STRUCT) {
                this.super_column = new SuperColumn();
                this.super_column.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();
}

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  va 2s.  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;
        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;//w w  w .j  a v a2 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;/*  www. j  a  va  2  s .  c om*/
    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.KeyRange.java

License:Apache License

public void read(TProtocol iprot) throws TException {
    TField field;//w w 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: // START_KEY
            if (field.type == TType.STRING) {
                this.start_key = iprot.readString();
            } else {
                TProtocolUtil.skip(iprot, field.type);
            }
            break;
        case 2: // END_KEY
            if (field.type == TType.STRING) {
                this.end_key = iprot.readString();
            } else {
                TProtocolUtil.skip(iprot, field.type);
            }
            break;
        case 3: // START_TOKEN
            if (field.type == TType.STRING) {
                this.start_token = iprot.readString();
            } else {
                TProtocolUtil.skip(iprot, field.type);
            }
            break;
        case 4: // END_TOKEN
            if (field.type == TType.STRING) {
                this.end_token = iprot.readString();
            } else {
                TProtocolUtil.skip(iprot, field.type);
            }
            break;
        case 5: // COUNT
            if (field.type == TType.I32) {
                this.count = iprot.readI32();
                setCountIsSet(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 (!isSetCount()) {
        throw new TProtocolException(
                "Required field 'count' was not found in serialized data! Struct: " + toString());
    }
    validate();
}

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

License:Apache License

public void read(TProtocol iprot) throws TException {
    TField field;//from   ww  w.j  a  v a 2 s  .c  o m
    iprot.readStructBegin();
    while (true) {
        field = iprot.readFieldBegin();
        if (field.type == TType.STOP) {
            break;
        }
        switch (field.id) {
        case 1: // KEY
            if (field.type == TType.STRING) {
                this.key = iprot.readString();
            } else {
                TProtocolUtil.skip(iprot, field.type);
            }
            break;
        case 2: // COLUMNS
            if (field.type == TType.LIST) {
                {
                    TList _list8 = iprot.readListBegin();
                    this.columns = new ArrayList<ColumnOrSuperColumn>(_list8.size);
                    for (int _i9 = 0; _i9 < _list8.size; ++_i9) {
                        ColumnOrSuperColumn _elem10;
                        _elem10 = new ColumnOrSuperColumn();
                        _elem10.read(iprot);
                        this.columns.add(_elem10);
                    }
                    iprot.readListEnd();
                }
            } 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();
}