Class BinaryPrefixer
java.lang.Object
org.jpos.iso.BinaryPrefixer
- All Implemented Interfaces:
Prefixer
BinaryPrefixer constructs a prefix storing the length in binary.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final BinaryPrefixerA length prefixer for up to 255 chars.static final BinaryPrefixerA length prefixer for up to 65535 chars. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintdecodeLength(byte[] b, int offset) Decodes an encoded length.voidencodeLength(int length, byte[] b) Fills a byte array with the field length data in raw form.intReturns the number of bytes taken up by the length encoding.
-
Field Details
-
B
A length prefixer for up to 255 chars. The length is encoded with 1 unsigned byte. -
BB
A length prefixer for up to 65535 chars. The length is encoded with 2 unsigned bytes.
-
-
Constructor Details
-
BinaryPrefixer
-
-
Method Details
-
encodeLength
Description copied from interface:PrefixerFills a byte array with the field length data in raw form.- Specified by:
encodeLengthin interfacePrefixer- Parameters:
length- The length to be encoded.b- The byte array to fill with the encoded length.
-
decodeLength
Description copied from interface:PrefixerDecodes an encoded length.- Specified by:
decodeLengthin interfacePrefixer- Parameters:
b- The byte array to scan for the length.offset- The offset to start scanning from.- Returns:
- The length in chars of the field data to follow this LengthPrefix.
-
getPackedLength
Description copied from interface:PrefixerReturns the number of bytes taken up by the length encoding.- Specified by:
getPackedLengthin interfacePrefixer
-