Package org.jpos.iso
Class AsciiPrefixer
- java.lang.Object
-
- org.jpos.iso.AsciiPrefixer
-
- All Implemented Interfaces:
Prefixer
public class AsciiPrefixer extends java.lang.Object implements Prefixer
AsciiPrefixer constructs a prefix for ASCII messages.
-
-
Field Summary
Fields Modifier and Type Field Description static AsciiPrefixer
L
A length prefixer for up to 9 chars.static AsciiPrefixer
LL
A length prefixer for up to 99 chars.static AsciiPrefixer
LLL
A length prefixer for up to 999 chars.static AsciiPrefixer
LLLL
A length prefixer for up to 9999 chars.static AsciiPrefixer
LLLLL
A length prefixer for up to 99999 chars.static AsciiPrefixer
LLLLLL
A length prefixer for up to 999999 chars.
-
Constructor Summary
Constructors Constructor Description AsciiPrefixer(int nDigits)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
decodeLength(byte[] b, int offset)
Decodes an encoded length.void
encodeLength(int length, byte[] b)
Fills a byte array with the field length data in raw form.int
getPackedLength()
Returns the number of bytes taken up by the length encoding.
-
-
-
Field Detail
-
L
public static final AsciiPrefixer L
A length prefixer for up to 9 chars. The length is encoded with 1 ASCII char representing 1 decimal digit.
-
LL
public static final AsciiPrefixer LL
A length prefixer for up to 99 chars. The length is encoded with 2 ASCII chars representing 2 decimal digits.
-
LLL
public static final AsciiPrefixer LLL
A length prefixer for up to 999 chars. The length is encoded with 3 ASCII chars representing 3 decimal digits.
-
LLLL
public static final AsciiPrefixer LLLL
A length prefixer for up to 9999 chars. The length is encoded with 4 ASCII chars representing 4 decimal digits.
-
LLLLL
public static final AsciiPrefixer LLLLL
A length prefixer for up to 99999 chars. The length is encoded with 5 ASCII chars representing 5 decimal digits.
-
LLLLLL
public static final AsciiPrefixer LLLLLL
A length prefixer for up to 999999 chars. The length is encoded with 6 ASCII chars representing 6 decimal digits.
-
-
Constructor Detail
-
AsciiPrefixer
public AsciiPrefixer(int nDigits)
-
-
Method Detail
-
encodeLength
public void encodeLength(int length, byte[] b) throws ISOException
Description copied from interface:Prefixer
Fills a byte array with the field length data in raw form.- Specified by:
encodeLength
in interfacePrefixer
- Parameters:
length
- The length to be encoded.b
- The byte array to fill with the encoded length.- Throws:
ISOException
-
decodeLength
public int decodeLength(byte[] b, int offset) throws ISOException
Description copied from interface:Prefixer
Decodes an encoded length.- Specified by:
decodeLength
in 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.
- Throws:
ISOException
-
getPackedLength
public int getPackedLength()
Description copied from interface:Prefixer
Returns the number of bytes taken up by the length encoding.- Specified by:
getPackedLength
in interfacePrefixer
-
-