Class BERTLVPackager
java.lang.Object
org.jpos.iso.ISOBasePackager
org.jpos.iso.packager.GenericPackager
org.jpos.tlv.packager.bertlv.BERTLVPackager
- All Implemented Interfaces:
Configurable, ISOPackager, GenericPackagerParams, LogSource
- Direct Known Subclasses:
DefaultICCBERTLVPackager
Packager for ISO 8825 BER TLV values.
-
Nested Class Summary
Nested classes/interfaces inherited from class GenericPackager
GenericPackager.GenericContentHandler, GenericPackager.GenericEntityResolverModifier and TypeClassDescriptionclassSAX content handler that builds the packager's field structure from the DTD-driven XML.static classSAX entity resolver that maps the GenericPackager DTD URIs to bundled resources. -
Field Summary
Fields inherited from class ISOBasePackager
fld, headerLength, logFieldName, logger, realm, thirdBitmapFieldModifier and TypeFieldDescriptionprotected ISOFieldPackager[]Per-field packagers indexed by field number.protected intNumber of leading bytes treated as the ISO header during unpack.protected booleanWhentrue, field descriptions are emitted as XML comments in unpack logs.protected LoggerLogger used to record pack/unpack diagnostics;nulldisables logging.protected StringLogger realm associated with this packager.protected intField number that carries the tertiary bitmap as a Data Element, or-999if not used. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract BinaryInterpreterReturns the interpreter used for encoding/decoding length bytes.protected abstract BERTLVFormatMapperReturns the format mapper for this packager's tag set.protected abstract BinaryInterpreterReturns the interpreter used for encoding/decoding tag bytes.protected abstract BinaryInterpreterReturns the interpreter used for encoding/decoding value bytes.byte[]pack(ISOComponent m) Pack the sub-field into a byte arraybyte[]pack(ISOComponent m, boolean nested, int startIdx, int endIdx) Packs a subset of sub-fields.protected byte[]packValue(String tagNameHex, ISOComponent c) Packs a single TLV value field.intunpack(ISOComponent m, byte[] b) Unpacks an ISO-8583 byte array into the given message container.intunpack(ISOComponent m, byte[] b, boolean nested) Unpacks BER-TLV encoded data.voidunpack(ISOComponent m, InputStream in) Unpacks an ISO-8583 message from an input stream into the given container.Methods inherited from class GenericPackager
emitBitMap, getBitMapfieldPackager, getDescription, getFirstField, getMaxValidField, readFile, readFile, setConfiguration, setGenericPackagerParams, setLoggerModifier and TypeMethodDescriptionprotected booleanIndicates whether a primary bitmap is emitted on pack.protected ISOFieldPackagerReturns the field packager used for the primary bitmap.Returns a human-readable description of this packager.protected intusually 2 for normal fields, 1 for bitmap-less or ANSI X9.2protected intReturns the highest valid field number for this packager.voidreadFile(InputStream input) Parse the field descriptions from an XML InputStream.voidParse the field descriptions from an XML file.voidPackager Configuration.voidApplies packager configuration from the SAX attributes of the packager XML element.voidAttaches aLoggerand realm to this log source.Methods inherited from class ISOBasePackager
createISOMsg, fieldUnpackLogger, getFieldDescription, getFieldPackager, getHeaderLength, getLogger, getRealm, getThirdBitmapField, setFieldPackager, setFieldPackager, setHeaderLength, setThirdBitmapFieldModifier and TypeMethodDescriptionFactory hook returning theISOMsgsubclass produced during unpack.protected static voidfieldUnpackLogger(LogEvent evt, int fldno, ISOComponent c, ISOFieldPackager fld, boolean logFieldName) Internal helper logging function.getFieldDescription(ISOComponent m, int fldNumber) Returns the human-readable description of a field as defined by its packager.getFieldPackager(int fldNumber) Returns the field packager registered for the given field number.intReturns the configured ISO header length in bytes.Returns the Logger associated with this source.getRealm()Returns the log realm associated with this source.intReturns the field number carrying the tertiary bitmap as a Data Element.voidsetFieldPackager(int fldNumber, ISOFieldPackager fieldPackager) Replaces the packager registered for a single field.voidsetFieldPackager(ISOFieldPackager[] fld) Replaces the per-field packager array.voidsetHeaderLength(int len) Sets the ISO header length in bytes.voidsetThirdBitmapField(int f) Configures the Data Element field that holds the tertiary bitmap.
-
Constructor Details
-
BERTLVPackager
Default constructor.- Throws:
ISOException- on configuration error
-
-
Method Details
-
getTagInterpreter
Returns the interpreter used for encoding/decoding tag bytes.- Returns:
- tag byte interpreter
-
getLengthInterpreter
Returns the interpreter used for encoding/decoding length bytes.- Returns:
- length byte interpreter
-
getValueInterpreter
Returns the interpreter used for encoding/decoding value bytes.- Returns:
- value byte interpreter
-
getTagFormatMapper
Returns the format mapper for this packager's tag set.- Returns:
- BER-TLV format mapper
-
pack
Pack the sub-field into a byte array- Specified by:
packin interfaceISOPackager- Overrides:
packin classISOBasePackager- Parameters:
m- the Component to pack- Returns:
- Message image
- Throws:
ISOException- if the component cannot be packed
-
pack
Packs a subset of sub-fields.- Parameters:
m- the ISO component to packnested- true if this is a nested (inner) packstartIdx- first field index to includeendIdx- last field index to include- Returns:
- packed bytes
- Throws:
ISOException- on packing error
-
unpack
Description copied from interface:ISOPackagerUnpacks an ISO-8583 byte array into the given message container.- Specified by:
unpackin interfaceISOPackager- Overrides:
unpackin classISOBasePackager- Parameters:
m- the Container of this messageb- ISO message image- Returns:
- consumed bytes
- Throws:
ISOException- if the message image cannot be unpacked
-
unpack
Unpacks BER-TLV encoded data.- Parameters:
m- target componentb- packed bytesnested- true for nested unpack- Returns:
- consumed bytes
- Throws:
ISOException- on unpacking error
-
packValue
protected byte[] packValue(String tagNameHex, ISOComponent c) throws ISOException, UnknownTagNumberException Packs a single TLV value field. Packs the value of the given component for the specified tag.- Parameters:
tagNameHex- the tag name as a hex stringc- the component to pack- Returns:
- packed value bytes
- Throws:
ISOException- on packing errorUnknownTagNumberException- if the tag is not recognised
-
unpack
Description copied from interface:ISOPackagerUnpacks an ISO-8583 message from an input stream into the given container.- Specified by:
unpackin interfaceISOPackager- Overrides:
unpackin classISOBasePackager- Parameters:
m- the containerin- the input stream- Throws:
IOException- on I/O failureISOException- on unpacking error
-