List of usage examples for org.apache.thrift.protocol TProtocol writeBool
public void writeBool(Boolean b) throws TException
From source file:backtype.storm.generated.HBMessageData.java
License:Apache License
@Override protected void standardSchemeWriteValue(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { switch (setField_) { case PATH://from www . j a v a2 s . c o m String path = (String) value_; oprot.writeString(path); return; case PULSE: HBPulse pulse = (HBPulse) value_; pulse.write(oprot); return; case BOOLVAL: Boolean boolval = (Boolean) value_; oprot.writeBool(boolval); return; case RECORDS: HBRecords records = (HBRecords) value_; records.write(oprot); return; case NODES: HBNodes nodes = (HBNodes) value_; nodes.write(oprot); return; case MESSAGE_BLOB: ByteBuffer message_blob = (ByteBuffer) value_; oprot.writeBinary(message_blob); return; default: throw new IllegalStateException("Cannot write union with unknown field " + setField_); } }
From source file:backtype.storm.generated.HBMessageData.java
License:Apache License
@Override protected void tupleSchemeWriteValue(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { switch (setField_) { case PATH://w w w. ja v a 2 s .c o m String path = (String) value_; oprot.writeString(path); return; case PULSE: HBPulse pulse = (HBPulse) value_; pulse.write(oprot); return; case BOOLVAL: Boolean boolval = (Boolean) value_; oprot.writeBool(boolval); return; case RECORDS: HBRecords records = (HBRecords) value_; records.write(oprot); return; case NODES: HBNodes nodes = (HBNodes) value_; nodes.write(oprot); return; case MESSAGE_BLOB: ByteBuffer message_blob = (ByteBuffer) value_; oprot.writeBinary(message_blob); return; default: throw new IllegalStateException("Cannot write union with unknown field " + setField_); } }
From source file:backtype.storm.generated.JavaObjectArg.java
License:Apache License
@Override protected void writeValue(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { switch (setField_) { case INT_ARG: Integer int_arg = (Integer) value_; oprot.writeI32(int_arg); return;// www . j a v a 2 s .co m case LONG_ARG: Long long_arg = (Long) value_; oprot.writeI64(long_arg); return; case STRING_ARG: String string_arg = (String) value_; oprot.writeString(string_arg); return; case BOOL_ARG: Boolean bool_arg = (Boolean) value_; oprot.writeBool(bool_arg); return; case BINARY_ARG: ByteBuffer binary_arg = (ByteBuffer) value_; oprot.writeBinary(binary_arg); return; case DOUBLE_ARG: Double double_arg = (Double) value_; oprot.writeDouble(double_arg); return; default: throw new IllegalStateException("Cannot write union with unknown field " + setField_); } }
From source file:backtype.storm.generated.StreamInfo.java
License:Apache License
public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { validate();/*from w ww. ja va 2 s . com*/ oprot.writeStructBegin(STRUCT_DESC); if (this.output_fields != null) { oprot.writeFieldBegin(OUTPUT_FIELDS_FIELD_DESC); { oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, this.output_fields.size())); for (String _iter11 : this.output_fields) { oprot.writeString(_iter11); } oprot.writeListEnd(); } oprot.writeFieldEnd(); } oprot.writeFieldBegin(DIRECT_FIELD_DESC); oprot.writeBool(this.direct); oprot.writeFieldEnd(); oprot.writeFieldStop(); oprot.writeStructEnd(); }
From source file:com.baidu.oped.apm.plugin.thrift.ThriftRequestProperty.java
License:Apache License
public void writeTraceHeader(ThriftHeader headerKey, TProtocol oprot) throws TException { Object headerValue = this.thriftHeaders.get(headerKey); if (headerValue == null) { return;// ww w. j a v a2 s .co m } byte headerType = headerKey.getType(); TField traceField = new TField(headerKey.name(), headerKey.getType(), headerKey.getId()); oprot.writeFieldBegin(traceField); try { if (headerType == TType.STRING) { // these will be read as byte buffer although it's probably safe to just use writeString here. // see org.apache.thrift.protocol.TProtocolUtil.skip(TProtocol, byte, int) oprot.writeBinary(stringToByteBuffer((String) headerValue)); } else if (headerType == TType.I64) { oprot.writeI64((Long) headerValue); } else if (headerType == TType.I16) { oprot.writeI16((Short) headerValue); } else if (headerType == TType.BOOL) { oprot.writeBool((Boolean) headerValue); } else { throw new TProtocolException("Invalid apm header type - " + headerType); } } finally { oprot.writeFieldEnd(); } }
From source file:com.bigdata.dastor.thrift.SliceRange.java
License:Apache License
public void write(TProtocol oprot) throws TException { validate();/*from w ww . j a v a 2s. c om*/ oprot.writeStructBegin(STRUCT_DESC); if (this.start != null) { oprot.writeFieldBegin(START_FIELD_DESC); oprot.writeBinary(this.start); oprot.writeFieldEnd(); } if (this.finish != null) { oprot.writeFieldBegin(FINISH_FIELD_DESC); oprot.writeBinary(this.finish); oprot.writeFieldEnd(); } oprot.writeFieldBegin(REVERSED_FIELD_DESC); oprot.writeBool(this.reversed); oprot.writeFieldEnd(); oprot.writeFieldBegin(COUNT_FIELD_DESC); oprot.writeI32(this.count); oprot.writeFieldEnd(); oprot.writeFieldStop(); oprot.writeStructEnd(); }
From source file:com.ebay.nest.io.sede.dynamic_type.DynamicSerDeTypeBool.java
License:Apache License
@Override public void serialize(Object o, ObjectInspector oi, TProtocol oprot) throws TException, SerDeException, NoSuchFieldException, IllegalAccessException { BooleanObjectInspector poi = (BooleanObjectInspector) oi; oprot.writeBool(poi.get(o)); }
From source file:com.facebook.swift.codec.internal.builtin.BooleanThriftCodec.java
License:Apache License
@Override public void write(Boolean value, TProtocol protocol) throws Exception { Preconditions.checkNotNull(value, "value is null"); Preconditions.checkNotNull(protocol, "protocol is null"); protocol.writeBool(value); }
From source file:com.mydlp.ui.thrift.LicenseObject.java
License:Open Source License
public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { validate();/* ww w .j a v a2 s . co m*/ oprot.writeStructBegin(STRUCT_DESC); if (this.license_type != null) { oprot.writeFieldBegin(LICENSE_TYPE_FIELD_DESC); oprot.writeString(this.license_type); oprot.writeFieldEnd(); } oprot.writeFieldBegin(NUMBER_OF_USERS_FIELD_DESC); oprot.writeI64(this.number_of_users); oprot.writeFieldEnd(); oprot.writeFieldBegin(ADMINISTRATIVE_USERS_FIELD_DESC); oprot.writeI64(this.administrative_users); oprot.writeFieldEnd(); oprot.writeFieldBegin(EXPIRATION_DATE_FIELD_DESC); oprot.writeI64(this.expiration_date); oprot.writeFieldEnd(); oprot.writeFieldBegin(IS_TRIAL_FIELD_DESC); oprot.writeBool(this.is_trial); oprot.writeFieldEnd(); oprot.writeFieldBegin(IS_VALID_FIELD_DESC); oprot.writeBool(this.is_valid); oprot.writeFieldEnd(); oprot.writeFieldBegin(NUMBER_OF_ALLOCATED_SEATS_FIELD_DESC); oprot.writeI64(this.number_of_allocated_seats); oprot.writeFieldEnd(); if (this.user_email != null) { oprot.writeFieldBegin(USER_EMAIL_FIELD_DESC); oprot.writeString(this.user_email); oprot.writeFieldEnd(); } if (this.logo_key != null) { oprot.writeFieldBegin(LOGO_KEY_FIELD_DESC); oprot.writeString(this.logo_key); oprot.writeFieldEnd(); } oprot.writeFieldStop(); oprot.writeStructEnd(); }
From source file:com.navercorp.pinpoint.plugin.thrift.ThriftRequestProperty.java
License:Apache License
public void writeTraceHeader(ThriftHeader headerKey, TProtocol oprot) throws TException { Object headerValue = this.thriftHeaders.get(headerKey); if (headerValue == null) { return;/*from w w w. ja v a 2 s .c om*/ } byte headerType = headerKey.getType(); TField traceField = new TField(headerKey.name(), headerKey.getType(), headerKey.getId()); oprot.writeFieldBegin(traceField); try { if (headerType == TType.STRING) { // these will be read as byte buffer although it's probably safe to just use writeString here. // see org.apache.thrift.protocol.TProtocolUtil.skip(TProtocol, byte, int) oprot.writeBinary(stringToByteBuffer((String) headerValue)); } else if (headerType == TType.I64) { oprot.writeI64((Long) headerValue); } else if (headerType == TType.I16) { oprot.writeI16((Short) headerValue); } else if (headerType == TType.BOOL) { oprot.writeBool((Boolean) headerValue); } else { throw new TProtocolException("Invalid pinpoint header type - " + headerType); } } finally { oprot.writeFieldEnd(); } }