Java Code Examples for org.apache.thrift.protocol.TProtocol#writeSetEnd()

The following examples show how to use org.apache.thrift.protocol.TProtocol#writeSetEnd() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SetTypeAdapterFactory.java    From Firefly with Apache License 2.0 5 votes vote down vote up
@Override
public void write(Set set, TProtocol protocol) throws TException {
    protocol.writeSetBegin(new TSet(valueTypeAdapter.getTType(), set.size()));
    for (Object o : set) {
        valueTypeAdapter.write(o, protocol);
    }
    protocol.writeSetEnd();
}
 
Example 2
Source File: ProtocolReadToWrite.java    From parquet-mr with Apache License 2.0 5 votes vote down vote up
private void readOneSet(TProtocol in, TProtocol out) throws TException {
  final TSet set = in.readSetBegin();
  out.writeSetBegin(set);
  readCollectionElements(in, out, set.size, set.elemType);
  in.readSetEnd();
  out.writeSetEnd();
}
 
Example 3
Source File: BufferedProtocolReadToWrite.java    From parquet-mr with Apache License 2.0 4 votes vote down vote up
@Override
public void write(TProtocol out) throws TException {
  out.writeSetEnd();
}
 
Example 4
Source File: ThriftSampleData.java    From incubator-pinot with Apache License 2.0 4 votes vote down vote up
public void write(TProtocol oprot, ThriftSampleData struct)
    throws TException {
  struct.validate();
  oprot.writeStructBegin(ThriftSampleData.STRUCT_DESC);
  if (struct.isSetId()) {
    oprot.writeFieldBegin(ThriftSampleData.ID_FIELD_DESC);
    oprot.writeI32(struct.id);
    oprot.writeFieldEnd();
  }

  if (struct.name != null && struct.isSetName()) {
    oprot.writeFieldBegin(ThriftSampleData.NAME_FIELD_DESC);
    oprot.writeString(struct.name);
    oprot.writeFieldEnd();
  }

  if (struct.isSetCreated_at()) {
    oprot.writeFieldBegin(ThriftSampleData.CREATED_AT_FIELD_DESC);
    oprot.writeI64(struct.created_at);
    oprot.writeFieldEnd();
  }

  if (struct.isSetActive()) {
    oprot.writeFieldBegin(ThriftSampleData.ACTIVE_FIELD_DESC);
    oprot.writeBool(struct.active);
    oprot.writeFieldEnd();
  }

  Iterator var3;
  if (struct.groups != null) {
    oprot.writeFieldBegin(ThriftSampleData.GROUPS_FIELD_DESC);
    oprot.writeListBegin(new TList((byte) 6, struct.groups.size()));
    var3 = struct.groups.iterator();

    while (var3.hasNext()) {
      short _iter10 = ((Short) var3.next()).shortValue();
      oprot.writeI16(_iter10);
    }

    oprot.writeListEnd();
    oprot.writeFieldEnd();
  }

  if (struct.map_values != null) {
    oprot.writeFieldBegin(ThriftSampleData.MAP_VALUES_FIELD_DESC);
    oprot.writeMapBegin(new TMap((byte) 11, (byte) 10, struct.map_values.size()));
    var3 = struct.map_values.entrySet().iterator();

    while (var3.hasNext()) {
      Entry<String, Long> _iter11 = (Entry) var3.next();
      oprot.writeString((String) _iter11.getKey());
      oprot.writeI64(((Long) _iter11.getValue()).longValue());
    }

    oprot.writeMapEnd();
    oprot.writeFieldEnd();
  }

  if (struct.set_values != null) {
    oprot.writeFieldBegin(ThriftSampleData.SET_VALUES_FIELD_DESC);
    oprot.writeSetBegin(new TSet((byte) 11, struct.set_values.size()));
    var3 = struct.set_values.iterator();

    while (var3.hasNext()) {
      String _iter12 = (String) var3.next();
      oprot.writeString(_iter12);
    }

    oprot.writeSetEnd();
    oprot.writeFieldEnd();
  }

  oprot.writeFieldStop();
  oprot.writeStructEnd();
}