/**
 * Autogenerated by Thrift Compiler (0.17.0)
 *
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 *  @generated
 */
package com.tim.packet;

@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"})
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.17.0)", date = "2023-02-11")
public class TimSock5Bytes implements org.apache.thrift.TBase<TimSock5Bytes, TimSock5Bytes._Fields>, java.io.Serializable, Cloneable, Comparable<TimSock5Bytes> {
  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TimSock5Bytes");

  private static final org.apache.thrift.protocol.TField PUB_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("pubId", org.apache.thrift.protocol.TType.STRING, (short)1);
  private static final org.apache.thrift.protocol.TField INDEX_FIELD_DESC = new org.apache.thrift.protocol.TField("index", org.apache.thrift.protocol.TType.I32, (short)2);
  private static final org.apache.thrift.protocol.TField BYTES_FIELD_DESC = new org.apache.thrift.protocol.TField("bytes", org.apache.thrift.protocol.TType.LIST, (short)3);
  private static final org.apache.thrift.protocol.TField EXTRA_MAP_FIELD_DESC = new org.apache.thrift.protocol.TField("extraMap", org.apache.thrift.protocol.TType.MAP, (short)4);

  private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new TimSock5BytesStandardSchemeFactory();
  private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new TimSock5BytesTupleSchemeFactory();

  /**
   * 发布id
   */
  public @org.apache.thrift.annotation.Nullable java.lang.String pubId; // required
  /**
   * 序号数据块
   */
  public int index; // required
  /**
   * 数据块
   */
  public @org.apache.thrift.annotation.Nullable java.util.List<java.nio.ByteBuffer> bytes; // required
  public @org.apache.thrift.annotation.Nullable java.util.Map<java.lang.String,java.lang.String> extraMap; // optional

  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
  public enum _Fields implements org.apache.thrift.TFieldIdEnum {
    /**
     * 发布id
     */
    PUB_ID((short)1, "pubId"),
    /**
     * 序号数据块
     */
    INDEX((short)2, "index"),
    /**
     * 数据块
     */
    BYTES((short)3, "bytes"),
    EXTRA_MAP((short)4, "extraMap");

    private static final java.util.Map<java.lang.String, _Fields> byName = new java.util.HashMap<java.lang.String, _Fields>();

    static {
      for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) {
        byName.put(field.getFieldName(), field);
      }
    }

    /**
     * Find the _Fields constant that matches fieldId, or null if its not found.
     */
    @org.apache.thrift.annotation.Nullable
    public static _Fields findByThriftId(int fieldId) {
      switch(fieldId) {
        case 1: // PUB_ID
          return PUB_ID;
        case 2: // INDEX
          return INDEX;
        case 3: // BYTES
          return BYTES;
        case 4: // EXTRA_MAP
          return EXTRA_MAP;
        default:
          return null;
      }
    }

    /**
     * Find the _Fields constant that matches fieldId, throwing an exception
     * if it is not found.
     */
    public static _Fields findByThriftIdOrThrow(int fieldId) {
      _Fields fields = findByThriftId(fieldId);
      if (fields == null) throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!");
      return fields;
    }

    /**
     * Find the _Fields constant that matches name, or null if its not found.
     */
    @org.apache.thrift.annotation.Nullable
    public static _Fields findByName(java.lang.String name) {
      return byName.get(name);
    }

    private final short _thriftId;
    private final java.lang.String _fieldName;

    _Fields(short thriftId, java.lang.String fieldName) {
      _thriftId = thriftId;
      _fieldName = fieldName;
    }

    @Override
    public short getThriftFieldId() {
      return _thriftId;
    }

    @Override
    public java.lang.String getFieldName() {
      return _fieldName;
    }
  }

  // isset id assignments
  private static final int __INDEX_ISSET_ID = 0;
  private byte __isset_bitfield = 0;
  private static final _Fields optionals[] = {_Fields.EXTRA_MAP};
  public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
  static {
    java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
    tmpMap.put(_Fields.PUB_ID, new org.apache.thrift.meta_data.FieldMetaData("pubId", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.INDEX, new org.apache.thrift.meta_data.FieldMetaData("index", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
    tmpMap.put(_Fields.BYTES, new org.apache.thrift.meta_data.FieldMetaData("bytes", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, 
            new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING            , true))));
    tmpMap.put(_Fields.EXTRA_MAP, new org.apache.thrift.meta_data.FieldMetaData("extraMap", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.MapMetaData(org.apache.thrift.protocol.TType.MAP, 
            new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING), 
            new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))));
    metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TimSock5Bytes.class, metaDataMap);
  }

  public TimSock5Bytes() {
  }

  public TimSock5Bytes(
    java.lang.String pubId,
    int index,
    java.util.List<java.nio.ByteBuffer> bytes)
  {
    this();
    this.pubId = pubId;
    this.index = index;
    setIndexIsSet(true);
    this.bytes = bytes;
  }

  /**
   * Performs a deep copy on <i>other</i>.
   */
  public TimSock5Bytes(TimSock5Bytes other) {
    __isset_bitfield = other.__isset_bitfield;
    if (other.isSetPubId()) {
      this.pubId = other.pubId;
    }
    this.index = other.index;
    if (other.isSetBytes()) {
      java.util.List<java.nio.ByteBuffer> __this__bytes = new java.util.ArrayList<java.nio.ByteBuffer>(other.bytes);
      this.bytes = __this__bytes;
    }
    if (other.isSetExtraMap()) {
      java.util.Map<java.lang.String,java.lang.String> __this__extraMap = new java.util.HashMap<java.lang.String,java.lang.String>(other.extraMap);
      this.extraMap = __this__extraMap;
    }
  }

  @Override
  public TimSock5Bytes deepCopy() {
    return new TimSock5Bytes(this);
  }

  @Override
  public void clear() {
    this.pubId = null;
    setIndexIsSet(false);
    this.index = 0;
    this.bytes = null;
    this.extraMap = null;
  }

  /**
   * 发布id
   */
  @org.apache.thrift.annotation.Nullable
  public java.lang.String getPubId() {
    return this.pubId;
  }

  /**
   * 发布id
   */
  public TimSock5Bytes setPubId(@org.apache.thrift.annotation.Nullable java.lang.String pubId) {
    this.pubId = pubId;
    return this;
  }

  public void unsetPubId() {
    this.pubId = null;
  }

  /** Returns true if field pubId is set (has been assigned a value) and false otherwise */
  public boolean isSetPubId() {
    return this.pubId != null;
  }

  public void setPubIdIsSet(boolean value) {
    if (!value) {
      this.pubId = null;
    }
  }

  /**
   * 序号数据块
   */
  public int getIndex() {
    return this.index;
  }

  /**
   * 序号数据块
   */
  public TimSock5Bytes setIndex(int index) {
    this.index = index;
    setIndexIsSet(true);
    return this;
  }

  public void unsetIndex() {
    __isset_bitfield = org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __INDEX_ISSET_ID);
  }

  /** Returns true if field index is set (has been assigned a value) and false otherwise */
  public boolean isSetIndex() {
    return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __INDEX_ISSET_ID);
  }

  public void setIndexIsSet(boolean value) {
    __isset_bitfield = org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __INDEX_ISSET_ID, value);
  }

  public int getBytesSize() {
    return (this.bytes == null) ? 0 : this.bytes.size();
  }

  @org.apache.thrift.annotation.Nullable
  public java.util.Iterator<java.nio.ByteBuffer> getBytesIterator() {
    return (this.bytes == null) ? null : this.bytes.iterator();
  }

  public void addToBytes(java.nio.ByteBuffer elem) {
    if (this.bytes == null) {
      this.bytes = new java.util.ArrayList<java.nio.ByteBuffer>();
    }
    this.bytes.add(elem);
  }

  /**
   * 数据块
   */
  @org.apache.thrift.annotation.Nullable
  public java.util.List<java.nio.ByteBuffer> getBytes() {
    return this.bytes;
  }

  /**
   * 数据块
   */
  public TimSock5Bytes setBytes(@org.apache.thrift.annotation.Nullable java.util.List<java.nio.ByteBuffer> bytes) {
    this.bytes = bytes;
    return this;
  }

  public void unsetBytes() {
    this.bytes = null;
  }

  /** Returns true if field bytes is set (has been assigned a value) and false otherwise */
  public boolean isSetBytes() {
    return this.bytes != null;
  }

  public void setBytesIsSet(boolean value) {
    if (!value) {
      this.bytes = null;
    }
  }

  public int getExtraMapSize() {
    return (this.extraMap == null) ? 0 : this.extraMap.size();
  }

  public void putToExtraMap(java.lang.String key, java.lang.String val) {
    if (this.extraMap == null) {
      this.extraMap = new java.util.HashMap<java.lang.String,java.lang.String>();
    }
    this.extraMap.put(key, val);
  }

  @org.apache.thrift.annotation.Nullable
  public java.util.Map<java.lang.String,java.lang.String> getExtraMap() {
    return this.extraMap;
  }

  public TimSock5Bytes setExtraMap(@org.apache.thrift.annotation.Nullable java.util.Map<java.lang.String,java.lang.String> extraMap) {
    this.extraMap = extraMap;
    return this;
  }

  public void unsetExtraMap() {
    this.extraMap = null;
  }

  /** Returns true if field extraMap is set (has been assigned a value) and false otherwise */
  public boolean isSetExtraMap() {
    return this.extraMap != null;
  }

  public void setExtraMapIsSet(boolean value) {
    if (!value) {
      this.extraMap = null;
    }
  }

  @Override
  public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) {
    switch (field) {
    case PUB_ID:
      if (value == null) {
        unsetPubId();
      } else {
        setPubId((java.lang.String)value);
      }
      break;

    case INDEX:
      if (value == null) {
        unsetIndex();
      } else {
        setIndex((java.lang.Integer)value);
      }
      break;

    case BYTES:
      if (value == null) {
        unsetBytes();
      } else {
        setBytes((java.util.List<java.nio.ByteBuffer>)value);
      }
      break;

    case EXTRA_MAP:
      if (value == null) {
        unsetExtraMap();
      } else {
        setExtraMap((java.util.Map<java.lang.String,java.lang.String>)value);
      }
      break;

    }
  }

  @org.apache.thrift.annotation.Nullable
  @Override
  public java.lang.Object getFieldValue(_Fields field) {
    switch (field) {
    case PUB_ID:
      return getPubId();

    case INDEX:
      return getIndex();

    case BYTES:
      return getBytes();

    case EXTRA_MAP:
      return getExtraMap();

    }
    throw new java.lang.IllegalStateException();
  }

  /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
  @Override
  public boolean isSet(_Fields field) {
    if (field == null) {
      throw new java.lang.IllegalArgumentException();
    }

    switch (field) {
    case PUB_ID:
      return isSetPubId();
    case INDEX:
      return isSetIndex();
    case BYTES:
      return isSetBytes();
    case EXTRA_MAP:
      return isSetExtraMap();
    }
    throw new java.lang.IllegalStateException();
  }

  @Override
  public boolean equals(java.lang.Object that) {
    if (that instanceof TimSock5Bytes)
      return this.equals((TimSock5Bytes)that);
    return false;
  }

  public boolean equals(TimSock5Bytes that) {
    if (that == null)
      return false;
    if (this == that)
      return true;

    boolean this_present_pubId = true && this.isSetPubId();
    boolean that_present_pubId = true && that.isSetPubId();
    if (this_present_pubId || that_present_pubId) {
      if (!(this_present_pubId && that_present_pubId))
        return false;
      if (!this.pubId.equals(that.pubId))
        return false;
    }

    boolean this_present_index = true;
    boolean that_present_index = true;
    if (this_present_index || that_present_index) {
      if (!(this_present_index && that_present_index))
        return false;
      if (this.index != that.index)
        return false;
    }

    boolean this_present_bytes = true && this.isSetBytes();
    boolean that_present_bytes = true && that.isSetBytes();
    if (this_present_bytes || that_present_bytes) {
      if (!(this_present_bytes && that_present_bytes))
        return false;
      if (!this.bytes.equals(that.bytes))
        return false;
    }

    boolean this_present_extraMap = true && this.isSetExtraMap();
    boolean that_present_extraMap = true && that.isSetExtraMap();
    if (this_present_extraMap || that_present_extraMap) {
      if (!(this_present_extraMap && that_present_extraMap))
        return false;
      if (!this.extraMap.equals(that.extraMap))
        return false;
    }

    return true;
  }

  @Override
  public int hashCode() {
    int hashCode = 1;

    hashCode = hashCode * 8191 + ((isSetPubId()) ? 131071 : 524287);
    if (isSetPubId())
      hashCode = hashCode * 8191 + pubId.hashCode();

    hashCode = hashCode * 8191 + index;

    hashCode = hashCode * 8191 + ((isSetBytes()) ? 131071 : 524287);
    if (isSetBytes())
      hashCode = hashCode * 8191 + bytes.hashCode();

    hashCode = hashCode * 8191 + ((isSetExtraMap()) ? 131071 : 524287);
    if (isSetExtraMap())
      hashCode = hashCode * 8191 + extraMap.hashCode();

    return hashCode;
  }

  @Override
  public int compareTo(TimSock5Bytes other) {
    if (!getClass().equals(other.getClass())) {
      return getClass().getName().compareTo(other.getClass().getName());
    }

    int lastComparison = 0;

    lastComparison = java.lang.Boolean.compare(isSetPubId(), other.isSetPubId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetPubId()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.pubId, other.pubId);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetIndex(), other.isSetIndex());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetIndex()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.index, other.index);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetBytes(), other.isSetBytes());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetBytes()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.bytes, other.bytes);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetExtraMap(), other.isSetExtraMap());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetExtraMap()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.extraMap, other.extraMap);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    return 0;
  }

  @org.apache.thrift.annotation.Nullable
  @Override
  public _Fields fieldForId(int fieldId) {
    return _Fields.findByThriftId(fieldId);
  }

  @Override
  public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
    scheme(iprot).read(iprot, this);
  }

  @Override
  public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
    scheme(oprot).write(oprot, this);
  }

  @Override
  public java.lang.String toString() {
    java.lang.StringBuilder sb = new java.lang.StringBuilder("TimSock5Bytes(");
    boolean first = true;

    sb.append("pubId:");
    if (this.pubId == null) {
      sb.append("null");
    } else {
      sb.append(this.pubId);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("index:");
    sb.append(this.index);
    first = false;
    if (!first) sb.append(", ");
    sb.append("bytes:");
    if (this.bytes == null) {
      sb.append("null");
    } else {
      org.apache.thrift.TBaseHelper.toString(this.bytes, sb);
    }
    first = false;
    if (isSetExtraMap()) {
      if (!first) sb.append(", ");
      sb.append("extraMap:");
      if (this.extraMap == null) {
        sb.append("null");
      } else {
        sb.append(this.extraMap);
      }
      first = false;
    }
    sb.append(")");
    return sb.toString();
  }

  public void validate() throws org.apache.thrift.TException {
    // check for required fields
    if (pubId == null) {
      throw new org.apache.thrift.protocol.TProtocolException("Required field 'pubId' was not present! Struct: " + toString());
    }
    // alas, we cannot check 'index' because it's a primitive and you chose the non-beans generator.
    if (bytes == null) {
      throw new org.apache.thrift.protocol.TProtocolException("Required field 'bytes' was not present! Struct: " + toString());
    }
    // check for sub-struct validity
  }

  private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
    try {
      write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
    } catch (org.apache.thrift.TException te) {
      throw new java.io.IOException(te);
    }
  }

  private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, java.lang.ClassNotFoundException {
    try {
      // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
      __isset_bitfield = 0;
      read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
    } catch (org.apache.thrift.TException te) {
      throw new java.io.IOException(te);
    }
  }

  private static class TimSock5BytesStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
    @Override
    public TimSock5BytesStandardScheme getScheme() {
      return new TimSock5BytesStandardScheme();
    }
  }

  private static class TimSock5BytesStandardScheme extends org.apache.thrift.scheme.StandardScheme<TimSock5Bytes> {

    @Override
    public void read(org.apache.thrift.protocol.TProtocol iprot, TimSock5Bytes struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TField schemeField;
      iprot.readStructBegin();
      while (true)
      {
        schemeField = iprot.readFieldBegin();
        if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { 
          break;
        }
        switch (schemeField.id) {
          case 1: // PUB_ID
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.pubId = iprot.readString();
              struct.setPubIdIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 2: // INDEX
            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
              struct.index = iprot.readI32();
              struct.setIndexIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 3: // BYTES
            if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
              {
                org.apache.thrift.protocol.TList _list244 = iprot.readListBegin();
                struct.bytes = new java.util.ArrayList<java.nio.ByteBuffer>(_list244.size);
                @org.apache.thrift.annotation.Nullable java.nio.ByteBuffer _elem245;
                for (int _i246 = 0; _i246 < _list244.size; ++_i246)
                {
                  _elem245 = iprot.readBinary();
                  struct.bytes.add(_elem245);
                }
                iprot.readListEnd();
              }
              struct.setBytesIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 4: // EXTRA_MAP
            if (schemeField.type == org.apache.thrift.protocol.TType.MAP) {
              {
                org.apache.thrift.protocol.TMap _map247 = iprot.readMapBegin();
                struct.extraMap = new java.util.HashMap<java.lang.String,java.lang.String>(2*_map247.size);
                @org.apache.thrift.annotation.Nullable java.lang.String _key248;
                @org.apache.thrift.annotation.Nullable java.lang.String _val249;
                for (int _i250 = 0; _i250 < _map247.size; ++_i250)
                {
                  _key248 = iprot.readString();
                  _val249 = iprot.readString();
                  struct.extraMap.put(_key248, _val249);
                }
                iprot.readMapEnd();
              }
              struct.setExtraMapIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          default:
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
        }
        iprot.readFieldEnd();
      }
      iprot.readStructEnd();

      // check for required fields of primitive type, which can't be checked in the validate method
      if (!struct.isSetIndex()) {
        throw new org.apache.thrift.protocol.TProtocolException("Required field 'index' was not found in serialized data! Struct: " + toString());
      }
      struct.validate();
    }

    @Override
    public void write(org.apache.thrift.protocol.TProtocol oprot, TimSock5Bytes struct) throws org.apache.thrift.TException {
      struct.validate();

      oprot.writeStructBegin(STRUCT_DESC);
      if (struct.pubId != null) {
        oprot.writeFieldBegin(PUB_ID_FIELD_DESC);
        oprot.writeString(struct.pubId);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldBegin(INDEX_FIELD_DESC);
      oprot.writeI32(struct.index);
      oprot.writeFieldEnd();
      if (struct.bytes != null) {
        oprot.writeFieldBegin(BYTES_FIELD_DESC);
        {
          oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, struct.bytes.size()));
          for (java.nio.ByteBuffer _iter251 : struct.bytes)
          {
            oprot.writeBinary(_iter251);
          }
          oprot.writeListEnd();
        }
        oprot.writeFieldEnd();
      }
      if (struct.extraMap != null) {
        if (struct.isSetExtraMap()) {
          oprot.writeFieldBegin(EXTRA_MAP_FIELD_DESC);
          {
            oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, struct.extraMap.size()));
            for (java.util.Map.Entry<java.lang.String, java.lang.String> _iter252 : struct.extraMap.entrySet())
            {
              oprot.writeString(_iter252.getKey());
              oprot.writeString(_iter252.getValue());
            }
            oprot.writeMapEnd();
          }
          oprot.writeFieldEnd();
        }
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

  }

  private static class TimSock5BytesTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
    @Override
    public TimSock5BytesTupleScheme getScheme() {
      return new TimSock5BytesTupleScheme();
    }
  }

  private static class TimSock5BytesTupleScheme extends org.apache.thrift.scheme.TupleScheme<TimSock5Bytes> {

    @Override
    public void write(org.apache.thrift.protocol.TProtocol prot, TimSock5Bytes struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
      oprot.writeString(struct.pubId);
      oprot.writeI32(struct.index);
      {
        oprot.writeI32(struct.bytes.size());
        for (java.nio.ByteBuffer _iter253 : struct.bytes)
        {
          oprot.writeBinary(_iter253);
        }
      }
      java.util.BitSet optionals = new java.util.BitSet();
      if (struct.isSetExtraMap()) {
        optionals.set(0);
      }
      oprot.writeBitSet(optionals, 1);
      if (struct.isSetExtraMap()) {
        {
          oprot.writeI32(struct.extraMap.size());
          for (java.util.Map.Entry<java.lang.String, java.lang.String> _iter254 : struct.extraMap.entrySet())
          {
            oprot.writeString(_iter254.getKey());
            oprot.writeString(_iter254.getValue());
          }
        }
      }
    }

    @Override
    public void read(org.apache.thrift.protocol.TProtocol prot, TimSock5Bytes struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
      struct.pubId = iprot.readString();
      struct.setPubIdIsSet(true);
      struct.index = iprot.readI32();
      struct.setIndexIsSet(true);
      {
        org.apache.thrift.protocol.TList _list255 = iprot.readListBegin(org.apache.thrift.protocol.TType.STRING);
        struct.bytes = new java.util.ArrayList<java.nio.ByteBuffer>(_list255.size);
        @org.apache.thrift.annotation.Nullable java.nio.ByteBuffer _elem256;
        for (int _i257 = 0; _i257 < _list255.size; ++_i257)
        {
          _elem256 = iprot.readBinary();
          struct.bytes.add(_elem256);
        }
      }
      struct.setBytesIsSet(true);
      java.util.BitSet incoming = iprot.readBitSet(1);
      if (incoming.get(0)) {
        {
          org.apache.thrift.protocol.TMap _map258 = iprot.readMapBegin(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING); 
          struct.extraMap = new java.util.HashMap<java.lang.String,java.lang.String>(2*_map258.size);
          @org.apache.thrift.annotation.Nullable java.lang.String _key259;
          @org.apache.thrift.annotation.Nullable java.lang.String _val260;
          for (int _i261 = 0; _i261 < _map258.size; ++_i261)
          {
            _key259 = iprot.readString();
            _val260 = iprot.readString();
            struct.extraMap.put(_key259, _val260);
          }
        }
        struct.setExtraMapIsSet(true);
      }
    }
  }

  private static <S extends org.apache.thrift.scheme.IScheme> S scheme(org.apache.thrift.protocol.TProtocol proto) {
    return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) ? STANDARD_SCHEME_FACTORY : TUPLE_SCHEME_FACTORY).getScheme();
  }
}

