List of usage examples for org.apache.thrift.protocol TProtocol readBool
public abstract boolean readBool() throws TException;
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 www .j ava 2 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 w w.j a va 2 s . co 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 ww.j a v a 2 s . co 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:backtype.storm.generated.StreamInfo.java
License:Apache License
public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { org.apache.thrift.protocol.TField field; iprot.readStructBegin();/*from w w w . j a va 2 s .c om*/ while (true) { field = iprot.readFieldBegin(); if (field.type == org.apache.thrift.protocol.TType.STOP) { break; } switch (field.id) { case 1: // OUTPUT_FIELDS if (field.type == org.apache.thrift.protocol.TType.LIST) { { org.apache.thrift.protocol.TList _list8 = iprot.readListBegin(); this.output_fields = new ArrayList<String>(_list8.size); for (int _i9 = 0; _i9 < _list8.size; ++_i9) { String _elem10; // required _elem10 = iprot.readString(); this.output_fields.add(_elem10); } iprot.readListEnd(); } } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); } break; case 2: // DIRECT if (field.type == org.apache.thrift.protocol.TType.BOOL) { this.direct = iprot.readBool(); set_direct_isSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); } break; default: org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); } iprot.readFieldEnd(); } iprot.readStructEnd(); validate(); }
From source file:com.bigdata.dastor.thrift.SliceRange.java
License:Apache License
public void read(TProtocol iprot) throws TException { TField field;//www . j ava2 s . co m iprot.readStructBegin(); while (true) { field = iprot.readFieldBegin(); if (field.type == TType.STOP) { break; } switch (field.id) { case 1: // START if (field.type == TType.STRING) { this.start = iprot.readBinary(); } else { TProtocolUtil.skip(iprot, field.type); } break; case 2: // FINISH if (field.type == TType.STRING) { this.finish = iprot.readBinary(); } else { TProtocolUtil.skip(iprot, field.type); } break; case 3: // REVERSED if (field.type == TType.BOOL) { this.reversed = iprot.readBool(); setReversedIsSet(true); } else { TProtocolUtil.skip(iprot, field.type); } break; case 4: // 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 (!isSetReversed()) { throw new TProtocolException( "Required field 'reversed' was not found in serialized data! Struct: " + toString()); } if (!isSetCount()) { throw new TProtocolException( "Required field 'count' was not found in serialized data! Struct: " + toString()); } validate(); }
From source file:com.ebay.nest.io.sede.dynamic_type.DynamicSerDeTypeBool.java
License:Apache License
@Override public Object deserialize(Object reuse, TProtocol iprot) throws SerDeException, TException, IllegalAccessException { boolean val = iprot.readBool(); if (val == false && iprot instanceof com.ebay.nest.io.sede.thrift.WriteNullsProtocol && ((com.ebay.nest.io.sede.thrift.WriteNullsProtocol) iprot).lastPrimitiveWasNull()) { return null; }//from w ww . j a va 2s. c o m return Boolean.valueOf(val); }
From source file:com.facebook.swift.codec.internal.builtin.BooleanThriftCodec.java
License:Apache License
@Override public Boolean read(TProtocol protocol) throws Exception { Preconditions.checkNotNull(protocol, "protocol is null"); return protocol.readBool(); }
From source file:com.mydlp.ui.thrift.LicenseObject.java
License:Open Source License
public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { org.apache.thrift.protocol.TField field; iprot.readStructBegin();// w w w . j a va2 s.com while (true) { field = iprot.readFieldBegin(); if (field.type == org.apache.thrift.protocol.TType.STOP) { break; } switch (field.id) { case 1: // LICENSE_TYPE if (field.type == org.apache.thrift.protocol.TType.STRING) { this.license_type = iprot.readString(); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); } break; case 2: // NUMBER_OF_USERS if (field.type == org.apache.thrift.protocol.TType.I64) { this.number_of_users = iprot.readI64(); setNumber_of_usersIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); } break; case 3: // ADMINISTRATIVE_USERS if (field.type == org.apache.thrift.protocol.TType.I64) { this.administrative_users = iprot.readI64(); setAdministrative_usersIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); } break; case 4: // EXPIRATION_DATE if (field.type == org.apache.thrift.protocol.TType.I64) { this.expiration_date = iprot.readI64(); setExpiration_dateIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); } break; case 5: // IS_TRIAL if (field.type == org.apache.thrift.protocol.TType.BOOL) { this.is_trial = iprot.readBool(); setIs_trialIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); } break; case 6: // IS_VALID if (field.type == org.apache.thrift.protocol.TType.BOOL) { this.is_valid = iprot.readBool(); setIs_validIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); } break; case 7: // NUMBER_OF_ALLOCATED_SEATS if (field.type == org.apache.thrift.protocol.TType.I64) { this.number_of_allocated_seats = iprot.readI64(); setNumber_of_allocated_seatsIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); } break; case 8: // USER_EMAIL if (field.type == org.apache.thrift.protocol.TType.STRING) { this.user_email = iprot.readString(); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); } break; case 9: // LOGO_KEY if (field.type == org.apache.thrift.protocol.TType.STRING) { this.logo_key = iprot.readString(); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type); } break; default: org.apache.thrift.protocol.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.ning.metrics.serialization.thrift.hadoop.TBoolean.java
License:Apache License
public void read(TProtocol iprot) throws TException { TField field;//from www.j a v a 2s. c o m iprot.readStructBegin(); while (true) { field = iprot.readFieldBegin(); if (field.type == TType.STOP) { break; } switch (field.id) { case 1: if (field.type == TType.BOOL) { this.value = iprot.readBool(); this.__isset.value = true; } else { TProtocolUtil.skip(iprot, field.type); } break; default: TProtocolUtil.skip(iprot, field.type); break; } iprot.readFieldEnd(); } iprot.readStructEnd(); }
From source file:com.ning.metrics.serialization.thrift.item.DataItemDeserializer.java
License:Apache License
public DataItem fromThrift(TProtocol protocol, TField field) throws TException { final DataItem dataItem; switch (field.type) { case TType.BOOL: dataItem = new BooleanDataItem(protocol.readBool()); break;/*from ww w . j av a2s .c o m*/ case TType.BYTE: dataItem = new ByteDataItem(protocol.readByte()); break; case TType.I16: dataItem = new ShortDataItem(protocol.readI16()); break; case TType.I32: dataItem = new IntegerDataItem(protocol.readI32()); break; case TType.I64: dataItem = new LongDataItem(protocol.readI64()); break; case TType.DOUBLE: dataItem = new DoubleDataItem(protocol.readDouble()); break; case TType.STRING: dataItem = new StringDataItem(protocol.readString()); //TODO: we only allow strings, this won't if data is binary (let presentation layer deal with this) break; default: throw new IllegalArgumentException(String.format("Unknown type %d", field.type)); } return dataItem; }