Package org.jpos.iso
Class BCDInterpreter
- java.lang.Object
-
- org.jpos.iso.BCDInterpreter
-
- All Implemented Interfaces:
Interpreter
public class BCDInterpreter extends java.lang.Object implements Interpreter
Implements BCD Interpreter. Numeric Strings (consisting of chars '0'..'9' are converted to and from BCD bytes. Thus, "1234" is converted into 2 bytes: 0x12, 0x34.
-
-
Field Summary
Fields Modifier and Type Field Description static BCDInterpreter
LEFT_PADDED
This BCDInterpreter sometimes adds a 0-nibble to the left.static BCDInterpreter
LEFT_PADDED_F
This BCDInterpreter sometimes adds a F-nibble to the left.static BCDInterpreter
RIGHT_PADDED
This BCDInterpreter sometimes adds a 0-nibble to the right.static BCDInterpreter
RIGHT_PADDED_F
This BCDInterpreter sometimes adds a F-nibble to the right.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getPackedLength(int nDataUnits)
Each numeric digit is packed into a nibble, so 2 digits per byte, plus the possibility of padding.void
interpret(java.lang.String data, byte[] b, int offset)
(non-Javadoc)java.lang.String
uninterpret(byte[] rawData, int offset, int length)
(non-Javadoc)
-
-
-
Field Detail
-
LEFT_PADDED
public static final BCDInterpreter LEFT_PADDED
This BCDInterpreter sometimes adds a 0-nibble to the left.
-
RIGHT_PADDED
public static final BCDInterpreter RIGHT_PADDED
This BCDInterpreter sometimes adds a 0-nibble to the right.
-
RIGHT_PADDED_F
public static final BCDInterpreter RIGHT_PADDED_F
This BCDInterpreter sometimes adds a F-nibble to the right.
-
LEFT_PADDED_F
public static final BCDInterpreter LEFT_PADDED_F
This BCDInterpreter sometimes adds a F-nibble to the left.
-
-
Method Detail
-
interpret
public void interpret(java.lang.String data, byte[] b, int offset)
(non-Javadoc)- Specified by:
interpret
in interfaceInterpreter
-
uninterpret
public java.lang.String uninterpret(byte[] rawData, int offset, int length)
(non-Javadoc)- Specified by:
uninterpret
in interfaceInterpreter
- Parameters:
rawData
- The interpreted data.offset
- The index in rawData to start interpreting at.length
- The number of data units to interpret.- Returns:
- The uninterpreted data.
-
getPackedLength
public int getPackedLength(int nDataUnits)
Each numeric digit is packed into a nibble, so 2 digits per byte, plus the possibility of padding.- Specified by:
getPackedLength
in interfaceInterpreter
-
-