Class HexNibblesPrefixer
java.lang.Object
org.jpos.iso.HexNibblesPrefixer
- All Implemented Interfaces:
Prefixer
HexNibblesPrefixer constructs a prefix storing the length in BCD.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final HexNibblesPrefixerLL (2-digit hex nibbles) prefixer instance.static final HexNibblesPrefixerLLL (3-digit hex nibbles) prefixer instance. -
Constructor Summary
ConstructorsConstructorDescriptionHexNibblesPrefixer(int nDigits) Constructs a HexNibblesPrefixer with the given number of digits. -
Method Summary
Modifier and TypeMethodDescriptionintdecodeLength(byte[] b, int offset) Decodes an encoded length from the byte array.voidencodeLength(int length, byte[] b) Encodes the field length into the byte array.intReturns the number of bytes taken up by the length encoding.
-
Field Details
-
LL
LL (2-digit hex nibbles) prefixer instance. -
LLL
LLL (3-digit hex nibbles) prefixer instance.
-
-
Constructor Details
-
HexNibblesPrefixer
Constructs a HexNibblesPrefixer with the given number of digits.- Parameters:
nDigits- number of hex nibble digits in the length prefix
-
-
Method Details
-
encodeLength
Description copied from interface:PrefixerEncodes the field length into the byte array.- Specified by:
encodeLengthin interfacePrefixer- Parameters:
length- the field length to encodeb- the byte array to write the length prefix into
-
decodeLength
Description copied from interface:PrefixerDecodes an encoded length from the byte array.- Specified by:
decodeLengthin interfacePrefixer- Parameters:
b- the byte array containing the length prefixoffset- the offset inbwhere the prefix starts- Returns:
- the length in chars of the field data to follow this prefix
-
getPackedLength
Description copied from interface:PrefixerReturns the number of bytes taken up by the length encoding.- Specified by:
getPackedLengthin interfacePrefixer- Returns:
- the number of bytes used by the length encoding
-