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; }
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; }
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()); }
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; }
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()); }
public void testUnpack() throws Exception { byte[] raw = new byte[]{0x30, 0x34, 0x01, 0x23}; IFA_LLBNUM packager = new IFA_LLBNUM(10, "Should be 0x30330123", true); ISOField field = new ISOField(); packager.unpack(field, raw, 0); assertEquals("0123", (String) field.getValue()); }
public void testUnpack() throws Exception { byte[] raw = new byte[] {(byte)0xF0, (byte)0xF4, (byte)0xF1, (byte)0xF2, (byte)0xF3, (byte)0xF4}; IFE_LLNUM packager = new IFE_LLNUM(10, "Should be 041234"); ISOField field = new ISOField(12); packager.unpack(field, raw, 0); assertEquals("1234", (String) field.getValue()); }
public void testUnpack() throws Exception { byte[] raw = new byte[]{65, 66, 67, 68, 32, 32, 32, 32, 32, 32}; IF_CHAR packager = new IF_CHAR(10, "Should be ABCD "); ISOField field = new ISOField(12); packager.unpack(field, raw, 0); assertEquals("ABCD ", (String) field.getValue()); }
public void testReversability() throws Exception { String origin = "0123456789ABCDEF"; ISOField f = new ISOField(12, origin); IFB_HEX packager = new IFB_HEX(origin.length(), "Should be 0123456789ABCDEF", true); ISOField unpack = new ISOField(12); packager.unpack(unpack, packager.pack(f), 0); assertEquals(origin, (String) unpack.getValue()); }
@Test public void testUnpackZeroLengthArray() throws Exception { byte[] raw = new byte[] {(byte) 0xF0}; IFE_LNUM packager = new IFE_LNUM(9, "testing unpacking an empty Array"); ISOField field = new ISOField(9); packager.unpack(field, raw, 0); assertEquals("", field.getValue()); }
@Test public void testUnpackOffsetArray() throws Exception { byte[] raw = new byte[] {0x30, 0x31, (byte) 0xF2, (byte) 0xF1, (byte) 0xF1}; IFE_LNUM packager = new IFE_LNUM(9, "testing unpacking a non empty Array with an offset"); ISOField field = new ISOField(9); packager.unpack(field, raw, 2); assertEquals("11", field.getValue()); } }
@Test public void testUnpackATwoLengthArray() throws Exception { byte[] raw = new byte[] {(byte) 0xF0, (byte) 0xF0, (byte) 0xF2, (byte) 0xF1, (byte) 0xF2}; IFE_LLLNUM packager = new IFE_LLLNUM(9, "testing unpacking a non empty Array"); ISOField field = new ISOField(9); packager.unpack(field, raw, 0); assertEquals("12", field.getValue()); }
public void testUnpackWithPackagerWithoutDescription() throws Exception { byte[] raw = new byte[] {(byte)0x30, (byte)0x34, (byte)0xF1, (byte)0xF2, (byte)0xF3, (byte)0xF4}; IFAE_LLCHAR packager = new IFAE_LLCHAR(); packager.setLength(10); ISOField field = new ISOField(12); packager.unpack(field, raw, 0); assertEquals("1234", (String) field.getValue()); }
public void testReversability() throws Exception { String origin = "Abc123:.-"; ISOField f = new ISOField(92, origin); IFEPE_LLCHAR packager = new IFEPE_LLCHAR(92, "Should be Abc123:.-"); ISOField unpack = new ISOField(); int len = packager.unpack(unpack, packager.pack(f), 0); assertEquals(origin.length()+2+2, len); assertEquals(origin, (String) unpack.getValue()); assertEquals(92,unpack.fieldNumber); // Derived from TAG! }
public void testReversability() throws Exception { String origin = "E0123456"; ISOField f = new ISOField(12, origin); IFB_AMOUNT packager = new IFB_AMOUNT(8, "Should be E0123456", true); ISOField unpack = new ISOField(12); packager.unpack(unpack, packager.pack(f), 0); assertEquals(origin, (String) unpack.getValue()); } }
public void testReversability() throws Exception { String origin = "Abc123"; ISOField f = new ISOField(12, origin); IFA_LCHAR packager = new IFA_LCHAR(8, "Should be Abc123"); ISOField unpack = new ISOField(12); packager.unpack(unpack, packager.pack(f), 0); assertEquals(origin, (String) unpack.getValue()); } }
public void testReversability() throws Exception { String origin = "Abc123:.-"; ISOField f = new ISOField(12, origin); IFA_FLLCHAR packager = new IFA_FLLCHAR(10, "Should be Abc123:.-"); ISOField unpack = new ISOField(12); packager.unpack(unpack, packager.pack(f), 0); assertEquals(origin, (String) unpack.getValue()); } }
public void testReversability() throws Exception { String origin = "Abc123:.-"; ISOField f = new ISOField(12, origin); IF_CHAR packager = new IF_CHAR(10, "Should be ABCD "); ISOField unpack = new ISOField(12); packager.unpack(unpack, packager.pack(f), 0); assertEquals(origin + " ", (String) unpack.getValue()); } }
public void testReversability() throws Exception { String origin = "1234567890"; ISOField f = new ISOField(12, origin); IFA_NUMERIC packager = new IFA_NUMERIC(10, "Should be 1234567890"); ISOField unpack = new ISOField(12); packager.unpack(unpack, packager.pack(f), 0); assertEquals(origin, (String) unpack.getValue()); } }
@Test public void testReversability() throws Exception { IFE_LLLNUM packager = new IFE_LLLNUM(9, "testing packing and unpacking cycle"); String originalData = "1234"; ISOField originalDataField = new ISOField(9, originalData); byte[] packedData = packager.pack(originalDataField); ISOField unpackedDataField = new ISOField(9); packager.unpack(unpackedDataField, packedData, 0); assertEquals(originalData, unpackedDataField.getValue()); }