use of org.jpos.iso.ISOField in project jPOS by jpos.
the class TagSequenceBase method writeTo.
@Override
public synchronized void writeTo(ISOMsg isoMsg) throws ISOException {
int maxField = isoMsg.getMaxField();
List<TagValue> tagValueList = getOrderedList();
int fieldNumber = 0;
for (TagValue tagValue : tagValueList) {
Object value = tagValue.getValue();
if (value != null) {
ISOComponent subField;
if (value instanceof byte[]) {
subField = new ISOBinaryField(fieldNumber + maxField + 1, (byte[]) value);
} else if (value instanceof String) {
subField = new ISOField(fieldNumber + maxField + 1, (String) value);
} else if (value instanceof TagSequence) {
TagSequence subSequence = (TagSequence) tagValue;
subField = new ISOMsg(fieldNumber + maxField + 1);
subSequence.writeTo((ISOMsg) subField);
} else if (value instanceof ISOMsg) {
ISOMsgTagValue subSequence = (ISOMsgTagValue) tagValue;
subField = subSequence.getValue();
subField.setFieldNumber(fieldNumber + maxField + 1);
} else {
throw new ISOException("Unknown TagValue subclass: " + tagValue.getClass());
}
isoMsg.set(new ISOTaggedField(tagValue.getTag(), subField));
}
fieldNumber++;
}
}
use of org.jpos.iso.ISOField in project jPOS by jpos.
the class IFTA_LLBINARY method unpackTag.
protected void unpackTag(ISOComponent c, InputStream in) throws ISOException, IOException {
ISOField tagField = new ISOField((Integer) c.getKey());
getTagPackager().unpack(tagField, in);
((ISOTaggedField) c).setTag(tagField.getValue().toString());
}
use of org.jpos.iso.ISOField in project jPOS by jpos.
the class IFTA_LLLBINARY method unpackTag.
protected int unpackTag(ISOComponent c, byte[] tagBytes, int offset) throws ISOException {
ISOField tagField = new ISOField((Integer) c.getKey());
int consumed = getTagPackager().unpack(tagField, tagBytes, offset);
((ISOTaggedField) c).setTag(tagField.getValue().toString());
return consumed;
}
use of org.jpos.iso.ISOField in project jPOS by jpos.
the class IFTA_LLLCHAR method unpackTag.
protected void unpackTag(ISOComponent c, InputStream in) throws ISOException, IOException {
ISOField tagField = new ISOField((Integer) c.getKey());
getTagPackager().unpack(tagField, in);
((ISOTaggedField) c).setTag(tagField.getValue().toString());
}
use of org.jpos.iso.ISOField in project jPOS by jpos.
the class IFTA_LLNUM method unpackTag.
protected int unpackTag(ISOComponent c, byte[] tagBytes, int offset) throws ISOException {
ISOField tagField = new ISOField((Integer) c.getKey());
int consumed = getTagPackager().unpack(tagField, tagBytes, offset);
((ISOTaggedField) c).setTag(tagField.getValue().toString());
return consumed;
}
Aggregations