List of usage examples for org.apache.thrift.protocol TProtocol writeBinary
public abstract void writeBinary(byte[] bin) throws TException;
From source file:backtype.storm.generated.ComponentObject.java
License:Apache License
@Override protected void writeValue(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { switch (setField_) { case SERIALIZED_JAVA: ByteBuffer serialized_java = (ByteBuffer) value_; oprot.writeBinary(serialized_java); return;// w w w .j a v a 2 s. c om case SHELL: ShellComponent shell = (ShellComponent) value_; shell.write(oprot); return; case JAVA_OBJECT: JavaObject java_object = (JavaObject) value_; java_object.write(oprot); return; default: throw new IllegalStateException("Cannot write union with unknown field " + setField_); } }
From source file:backtype.storm.generated.Grouping.java
License:Apache License
@Override protected void writeValue(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { switch (setField_) { case FIELDS:// w w w . j a va 2 s . c o m List<String> fields = (List<String>) value_; { oprot.writeListBegin( new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, fields.size())); for (String _iter7 : fields) { oprot.writeString(_iter7); } oprot.writeListEnd(); } return; case SHUFFLE: NullStruct shuffle = (NullStruct) value_; shuffle.write(oprot); return; case ALL: NullStruct all = (NullStruct) value_; all.write(oprot); return; case NONE: NullStruct none = (NullStruct) value_; none.write(oprot); return; case DIRECT: NullStruct direct = (NullStruct) value_; direct.write(oprot); return; case CUSTOM_OBJECT: JavaObject custom_object = (JavaObject) value_; custom_object.write(oprot); return; case CUSTOM_SERIALIZED: ByteBuffer custom_serialized = (ByteBuffer) value_; oprot.writeBinary(custom_serialized); return; case LOCAL_OR_SHUFFLE: NullStruct local_or_shuffle = (NullStruct) value_; local_or_shuffle.write(oprot); 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 standardSchemeWriteValue(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { switch (setField_) { case PATH://from w ww .j av 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.HBMessageData.java
License:Apache License
@Override protected void tupleSchemeWriteValue(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { switch (setField_) { case PATH:// www .j a v a 2s. 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;//w w w.ja v a 2 s .c om 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: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;/*from w ww .j a v a2 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 apm header type - " + headerType); } } finally { oprot.writeFieldEnd(); } }
From source file:com.bigdata.dastor.thrift.Column.java
License:Apache License
public void write(TProtocol oprot) throws TException { validate();//www . ja v a2 s. com oprot.writeStructBegin(STRUCT_DESC); if (this.name != null) { oprot.writeFieldBegin(NAME_FIELD_DESC); oprot.writeBinary(this.name); oprot.writeFieldEnd(); } if (this.value != null) { oprot.writeFieldBegin(VALUE_FIELD_DESC); oprot.writeBinary(this.value); oprot.writeFieldEnd(); } oprot.writeFieldBegin(TIMESTAMP_FIELD_DESC); oprot.writeI64(this.timestamp); oprot.writeFieldEnd(); oprot.writeFieldStop(); oprot.writeStructEnd(); }
From source file:com.bigdata.dastor.thrift.ColumnParent.java
License:Apache License
public void write(TProtocol oprot) throws TException { validate();/* ww w. j av a 2 s . c o m*/ oprot.writeStructBegin(STRUCT_DESC); if (this.column_family != null) { oprot.writeFieldBegin(COLUMN_FAMILY_FIELD_DESC); oprot.writeString(this.column_family); oprot.writeFieldEnd(); } if (this.super_column != null) { if (isSetSuper_column()) { oprot.writeFieldBegin(SUPER_COLUMN_FIELD_DESC); oprot.writeBinary(this.super_column); oprot.writeFieldEnd(); } } oprot.writeFieldStop(); oprot.writeStructEnd(); }
From source file:com.bigdata.dastor.thrift.ColumnPath.java
License:Apache License
public void write(TProtocol oprot) throws TException { validate();/*from ww w. jav a 2s .c o m*/ oprot.writeStructBegin(STRUCT_DESC); if (this.column_family != null) { oprot.writeFieldBegin(COLUMN_FAMILY_FIELD_DESC); oprot.writeString(this.column_family); oprot.writeFieldEnd(); } if (this.super_column != null) { if (isSetSuper_column()) { oprot.writeFieldBegin(SUPER_COLUMN_FIELD_DESC); oprot.writeBinary(this.super_column); oprot.writeFieldEnd(); } } if (this.column != null) { if (isSetColumn()) { oprot.writeFieldBegin(COLUMN_FIELD_DESC); oprot.writeBinary(this.column); oprot.writeFieldEnd(); } } oprot.writeFieldStop(); oprot.writeStructEnd(); }
From source file:com.bigdata.dastor.thrift.Deletion.java
License:Apache License
public void write(TProtocol oprot) throws TException { validate();/* w ww. j a v a 2s . c o m*/ oprot.writeStructBegin(STRUCT_DESC); oprot.writeFieldBegin(TIMESTAMP_FIELD_DESC); oprot.writeI64(this.timestamp); oprot.writeFieldEnd(); if (this.super_column != null) { if (isSetSuper_column()) { oprot.writeFieldBegin(SUPER_COLUMN_FIELD_DESC); oprot.writeBinary(this.super_column); oprot.writeFieldEnd(); } } if (this.predicate != null) { if (isSetPredicate()) { oprot.writeFieldBegin(PREDICATE_FIELD_DESC); this.predicate.write(oprot); oprot.writeFieldEnd(); } } oprot.writeFieldStop(); oprot.writeStructEnd(); }