use of org.jpos.emv.UnknownTagNumberException in project jPOS by jpos.
the class BERTLVPackager method packTLV.
private byte[] packTLV(ISOTaggedField c) throws ISOException {
byte[] b;
final byte[] rawValueBytes;
try {
rawValueBytes = packValue(c.getTag(), c);
} catch (UnknownTagNumberException e) {
throw new ISOException(e);
}
byte[] valueBytes = new byte[valueInterpreter.getPackedLength(rawValueBytes.length)];
valueInterpreter.interpret(rawValueBytes, valueBytes, 0);
byte[] tagBytes = packTag(c);
byte[] lengthBytes = packLength(valueBytes);
b = new byte[tagBytes.length + lengthBytes.length + valueBytes.length];
System.arraycopy(tagBytes, 0, b, 0, tagBytes.length);
System.arraycopy(lengthBytes, 0, b, tagBytes.length, lengthBytes.length);
System.arraycopy(valueBytes, 0, b, tagBytes.length + lengthBytes.length, valueBytes.length);
return b;
}
Aggregations