Package networkTransfer.send
Class NetworkObjectPacker
java.lang.Object
networkTransfer.send.NetworkObjectPacker
Functions to pack up data for sending over the network.
- Author:
- Doug Gillespie
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionbyte[]
packData
(int buoyId1, int buoyId2, short dataType1, int dataType2, byte[] data) byte[]
packData
(int buoyId1, int buoyId2, short dataType1, int dataType2, byte[] data, int dataLength) Pack any type of data for TCP transfer between programmes.byte[]
packData
(NetworkObject netObj) byte[]
packDataUnit
(int buoyId1, int buoyId2, PamDataBlock dataBlock, PamDataUnit dataUnit) Pack a data unit as a byte array for TCPIP transfer.packDataUnit
(PamDataBlock dataBlock, PamDataUnit dataUnit) Pack a data unit as a json-formatted String for TCP/IP transfer
-
Field Details
-
DATASTARTFLAG
public static final int DATASTARTFLAG- See Also:
-
-
Constructor Details
-
NetworkObjectPacker
public NetworkObjectPacker()
-
-
Method Details
-
packData
public byte[] packData(int buoyId1, int buoyId2, short dataType1, int dataType2, byte[] data) -
packDataUnit
Pack a data unit as a json-formatted String for TCP/IP transfer- Parameters:
dataBlock
-dataUnit
-- Returns:
-
packDataUnit
Pack a data unit as a byte array for TCPIP transfer. Note that data units get additional head information comprising an objectid, a time in millis and the actual datalength.- Parameters:
buoyId1
-buoyId2
-dataBlock
-dataUnit
-- Returns:
-
packData
-
packData
public byte[] packData(int buoyId1, int buoyId2, short dataType1, int dataType2, byte[] data, int dataLength) Pack any type of data for TCP transfer between programmes.- Parameters:
buoyId1
- buoy id1buoyId2
- buoy id2dataType1
- first data identifierdataType2
- second data identifierdata
- datadataLength
- length of data in bytes.- Returns:
- byte packed array
-