Fragmenter

public class Fragmenter extends Object

Class for decomposing and decoding byte data received from the jacquard tag.

Constructors

Fragmenter

public Fragmenter(String name, int mtuSize)

Parameters

Name Description
String name
int mtuSize

Methods

fragmentData

public List<byte> fragmentData(byte[] message)

Decomposes a message into fragments.

Parameters

Name Description
byte[] message

The message to fragment.

ReturnValue

Name Description
List<byte>

An ArrayListof fragments.

decodeFragment

public byte decodeFragment(byte[] fragment)

Decodes a message fragment returning the message if it is complete.

Note: This method will validate the fragment number and message length. If fragments are received out of sequence of the final message size does not match the reported size, then the message state will be reset.

Parameters

Name Description
byte[] fragment

ReturnValue

Name Description
byte

The complete message if the given fragment is valid and the last in the sequence, null otherwise.

reset

public void reset()

Resets the message state.

ReturnValue

Name Description
void