Class NetworkObject

java.lang.Object
networkTransfer.NetworkObject

public class NetworkObject extends Object
Class for handling Network data, will reduce number of parameters in Network calls and be a LOT more flexible. Use with NetworkObjectPacker.
Author:
dg50
  • Field Details

  • Constructor Details

    • NetworkObject

      public NetworkObject(int buoyId1, int buoyId2, short dataType1, int dataType2, byte[] data, int dataLength)
    • NetworkObject

      public NetworkObject(int dataVersion, int buoyId1, int buoyId2, short dataType1, int dataType2, String string)
    • NetworkObject

      public NetworkObject(int dataVersion, int buoyId1, int buoyId2, short dataType1, int dataType2, byte[] data)
    • NetworkObject

      public NetworkObject(Socket clientSocket, int dataVersion, short buoyId1, short buoyId2, short dataType1, int dataType2, byte[] data, int dataLength)
  • Method Details

    • getBuoyId1

      public int getBuoyId1()
      Returns:
      the buoyId1
    • getBuoyId2

      public int getBuoyId2()
      Returns:
      the buoyId2
    • getDataType1

      public short getDataType1()
      Returns:
      the dataType1
    • getDataType2

      public int getDataType2()
      Returns:
      the dataType2
    • getData

      public byte[] getData()
      Returns:
      the data
    • getDataLength

      public int getDataLength()
      This is the length of the data. The actual amount of data transmitted will be this + 24 bytes rounded up to nearest 4.
      Returns:
      the dataLength
    • getTransferedLength

      public int getTransferedLength()
      Amount of data actually transferred. 24 + a few more than data length.
      Returns:
      number of bytes.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getSocket

      public Socket getSocket()
      Returns:
      the socket
    • setSocket

      public void setSocket(Socket socket)
      Parameters:
      socket - the socket to set
    • getDataVersion

      public short getDataVersion()
      Returns:
      the dataVersion