Package networkTransfer
Class NetworkObject
java.lang.Object
networkTransfer.NetworkObject
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 Summary
-
Constructor Summary
ConstructorDescriptionNetworkObject
(int dataVersion, int buoyId1, int buoyId2, short dataType1, int dataType2, byte[] data) NetworkObject
(int dataVersion, int buoyId1, int buoyId2, short dataType1, int dataType2, String string) NetworkObject
(int buoyId1, int buoyId2, short dataType1, int dataType2, byte[] data, int dataLength) NetworkObject
(Socket clientSocket, int dataVersion, short buoyId1, short buoyId2, short dataType1, int dataType2, byte[] data, int dataLength) -
Method Summary
-
Field Details
-
CURRENTVERSION
public static final int CURRENTVERSION- See Also:
-
-
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
-
getSocket
- Returns:
- the socket
-
setSocket
- Parameters:
socket
- the socket to set
-
getDataVersion
public short getDataVersion()- Returns:
- the dataVersion
-