org.licas.server.model

## Class PacketMessages

- java.lang.Object
- - org.licas.server.model.PacketMessages

-     public class PacketMessages
      extends java.lang.Object

  This processes the message lists being sent using packet sizes, saves and re-parses them.
  Author:
    Kieran Greer

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected java.util.HashMap<java.lang.String,PacketInfo>` | `packetMsgs` Stores communication ids with related message packet info for receiving messages in packets.
    `protected java.lang.Object` | `syncOn` To synchronize on

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `PacketMessages()` Create a new instance of PacketMessages

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `addMessagePacket(java.lang.String communicationID, java.lang.String packetObject)` Add the message packet to the appropriate file as indicated by the communication id.
    `boolean` | `addPacketCommunicationID(java.lang.String communicationID, int packetSize)` Add the communication id and packet info to the packetInfo structure.
    `MethodInfo` | `endOfMessage(java.lang.String communicationID)` Call this to indicate that the whole message has been sent and should now be executed.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### packetMsgs

          protected java.util.HashMap<java.lang.String,PacketInfo> packetMsgs

      Stores communication ids with related message packet info for receiving messages in packets. Keys are the communication ids of type String, while values are the PacketInfo objects.

    - #### syncOn

          protected final java.lang.Object syncOn

      To synchronize on

  - ### Constructor Detail

    - #### PacketMessages

          public PacketMessages()

      Create a new instance of PacketMessages

  - ### Method Detail

    - #### addPacketCommunicationID

          public boolean addPacketCommunicationID(java.lang.String communicationID,
                                                  int packetSize)
                                           throws java.lang.Exception

      Add the communication id and packet info to the packetInfo structure.
      Parameters:
        `communicationID` - the id to identify the communication thread.
        `packetSize` - the maximum size of the packet to send.
      Returns:
        true if the id and the file name are new and the file can be created.
      Throws:
        `java.lang.Exception` - any error.

    - #### addMessagePacket

          public boolean addMessagePacket(java.lang.String communicationID,
                                          java.lang.String packetObject)
                                   throws java.lang.Exception

      Add the message packet to the appropriate file as indicated by the communication id.
      Parameters:
        `communicationID` - the id to identify the communication thread.
        `packetObject` - the next part of the message to save.
      Returns:
        true if the packet is successfully added to the file.
      Throws:
        `java.lang.Exception` - any error.

    - #### endOfMessage

          public MethodInfo endOfMessage(java.lang.String communicationID)
                                  throws java.lang.Exception

      Call this to indicate that the whole message has been sent and should now be executed.
      Parameters:
        `communicationID` - the id to identify the communication thread.
      Returns:
        the parsed method info.
      Throws:
        `java.lang.Exception` - any error.