Class ClientMsgProtobuf<BodyType extends com.google.protobuf.GeneratedMessageV3.Builder<BodyType>>

  • Type Parameters:
    BodyType - The body type of this message.
    All Implemented Interfaces:
    IClientMsg

    public class ClientMsgProtobuf<BodyType extends com.google.protobuf.GeneratedMessageV3.Builder<BodyType>>
    extends AClientMsgProtobuf
    Represents a protobuf backed client message.
    • Constructor Detail

      • ClientMsgProtobuf

        public ClientMsgProtobuf​(java.lang.Class<? extends com.google.protobuf.AbstractMessage> clazz,
                                 IPacketMsg msg)
        Initializes a new instance of the ClientMsgProtobuf class. This is a client send constructor.
        Parameters:
        clazz - the type of the body
        msg - The network message type this client message represents.
      • ClientMsgProtobuf

        public ClientMsgProtobuf​(java.lang.Class<? extends com.google.protobuf.AbstractMessage> clazz,
                                 IPacketMsg msg,
                                 int payloadReserve)
        Initializes a new instance of the ClientMsgProtobuf class. This is a client send constructor.
        Parameters:
        clazz - the type of the body
        msg - The network message type this client message represents.
        payloadReserve - The number of bytes to initialize the payload capacity to.
      • ClientMsgProtobuf

        public ClientMsgProtobuf​(java.lang.Class<? extends com.google.protobuf.AbstractMessage> clazz,
                                 EMsg eMsg)
        Initializes a new instance of the ClientMsgProtobuf class. This is a client send constructor.
        Parameters:
        clazz - the type of the body
        eMsg - The network message type this client message represents.
      • ClientMsgProtobuf

        public ClientMsgProtobuf​(java.lang.Class<? extends com.google.protobuf.AbstractMessage> clazz,
                                 EMsg eMsg,
                                 int payloadReserve)
        Initializes a new instance of the ClientMsgProtobuf class. This is a client send constructor.
        Parameters:
        clazz - the type of the body
        eMsg - The network message type this client message represents.
        payloadReserve - The number of bytes to initialize the payload capacity to.
      • ClientMsgProtobuf

        public ClientMsgProtobuf​(java.lang.Class<? extends com.google.protobuf.AbstractMessage> clazz,
                                 EMsg eMsg,
                                 MsgBase<MsgHdrProtoBuf> msg)
        Initializes a new instance of the ClientMsgProtobuf class. This is a reply constructor.
        Parameters:
        clazz - the type of the body
        eMsg - The network message type this client message represents.
        msg - The message that this instance is a reply for.
      • ClientMsgProtobuf

        public ClientMsgProtobuf​(java.lang.Class<? extends com.google.protobuf.AbstractMessage> clazz,
                                 EMsg eMsg,
                                 MsgBase<MsgHdrProtoBuf> msg,
                                 int payloadReserve)
        Initializes a new instance of the ClientMsgProtobuf class. This is a reply constructor.
        Parameters:
        clazz - the type of the body
        eMsg - The network message type this client message represents.
        msg - The message that this instance is a reply for.
        payloadReserve - The number of bytes to initialize the payload capacity to.
    • Method Detail

      • getBody

        public BodyType getBody()
        Returns:
        the body structure of this message.
      • setBody

        public void setBody​(BodyType _body)
        Sets the body of this message.
        Parameters:
        _body - the body structure of this message.
      • serialize

        public byte[] serialize()
        Description copied from interface: IClientMsg
        serializes this client message instance to a byte array.
        Specified by:
        serialize in interface IClientMsg
        Overrides:
        serialize in class AClientMsgProtobuf
        Returns:
        Data representing a client message.
      • deserialize

        public void deserialize​(byte[] data)
        Description copied from interface: IClientMsg
        Initializes this client message by deserializing the specified data.
        Specified by:
        deserialize in interface IClientMsg
        Overrides:
        deserialize in class AClientMsgProtobuf
        Parameters:
        data - The data representing a client message.