@Override public void write(org.apache.thrift.protocol.TProtocol prot, BlockInfo struct) throws org.apache.thrift.TException { TTupleProtocol oprot = (TTupleProtocol) prot; BitSet optionals = new BitSet(); if (struct.isSetBlockId()) { optionals.set(0); } if (struct.isSetLength()) { optionals.set(1); } if (struct.isSetLocations()) { optionals.set(2); } oprot.writeBitSet(optionals, 3); if (struct.isSetBlockId()) { oprot.writeI64(struct.blockId); } if (struct.isSetLength()) { oprot.writeI64(struct.length); } if (struct.isSetLocations()) { { oprot.writeI32(struct.locations.size()); for (BlockLocation _iter4 : struct.locations) { _iter4.write(oprot); } } } }
public void write(org.apache.thrift.protocol.TProtocol oprot, BlockInfo struct) throws org.apache.thrift.TException { struct.validate(); oprot.writeStructBegin(STRUCT_DESC); oprot.writeFieldBegin(BLOCK_ID_FIELD_DESC); oprot.writeI64(struct.blockId); oprot.writeFieldEnd(); oprot.writeFieldBegin(LENGTH_FIELD_DESC); oprot.writeI64(struct.length); oprot.writeFieldEnd(); if (struct.locations != null) { oprot.writeFieldBegin(LOCATIONS_FIELD_DESC); { oprot.writeListBegin( new org.apache.thrift.protocol.TList( org.apache.thrift.protocol.TType.STRUCT, struct.locations.size())); for (BlockLocation _iter3 : struct.locations) { _iter3.write(oprot); } oprot.writeListEnd(); } oprot.writeFieldEnd(); } oprot.writeFieldStop(); oprot.writeStructEnd(); }