@Test public void testUnpack() throws Exception { byte[] raw = new byte[] {(byte)0xF0, (byte)0xF0,(byte)0xf5, (byte)0xF9, (byte)0xF2, (byte)0xF1, (byte)0xF2, (byte)0xF3}; IFELPE_LLLCHAR packager = new IFELPE_LLLCHAR(10, "Should be F0F0F5F9F2F1F2F3"); ISOField field = new ISOField(); int len = packager.unpack(field, raw, 0); assertEquals(raw.length, len); assertEquals("123", (String) field.getValue()); assertEquals(92, field.fieldNumber); }
@Override public int unpack(final ISOComponent c, final byte[] b, final int offset) throws ISOException { final String asciiResult = ISOUtil.ebcdicToAscii(b, offset, LENGTH_BYTE_LENGTH); final int len = Integer.parseInt(asciiResult) - TAG_BYTE_LENGTH; if (!(c instanceof ISOField)) throw new ISOException(c.getClass() .getName() + " is not an ISOField"); c.setFieldNumber(Integer.parseInt(ISOUtil.ebcdicToAscii(b, offset + LENGTH_BYTE_LENGTH, TAG_BYTE_LENGTH))); c.setValue(ISOUtil.ebcdicToAscii(b, offset + TAG_HEADER_LENGTH, len)); return len + 5; }
IFELPE_LLLCHAR extends ISOFieldPackager { @Override public int unpack(final ISOComponent c, final byte[] b, final int offset) throws ISOException { final String asciiResult = ISOUtil.ebcdicToAscii(b, offset, LENGTH_BYTE_LENGTH); final int len = Integer.parseInt(asciiResult) - TAG_BYTE_LENGTH; if (!(c instanceof ISOField)) throw new ISOException(c.getClass() .getName() + " is not an ISOField"); c.setFieldNumber(Integer.parseInt(ISOUtil.ebcdicToAscii(b, offset + LENGTH_BYTE_LENGTH, TAG_BYTE_LENGTH))); c.setValue(ISOUtil.ebcdicToAscii(b, offset + TAG_HEADER_LENGTH, len)); return len + 5; } }
IFELPE_LLLCHAR extends ISOFieldPackager { @Override public int unpack(final ISOComponent c, final byte[] b, final int offset) throws ISOException { final String asciiResult = ISOUtil.ebcdicToAscii(b, offset, LENGTH_BYTE_LENGTH); final int len = Integer.parseInt(asciiResult) - TAG_BYTE_LENGTH; if (!(c instanceof ISOField)) throw new ISOException(c.getClass() .getName() + " is not an ISOField"); c.setFieldNumber(Integer.parseInt(ISOUtil.ebcdicToAscii(b, offset + LENGTH_BYTE_LENGTH, TAG_BYTE_LENGTH))); c.setValue(ISOUtil.ebcdicToAscii(b, offset + TAG_HEADER_LENGTH, len)); return len + 5; } IFELPE_LLLCHAR();  IFELPE_LLLCHAR(int len, String description); }
IFELPE_LLLCHAR extends ISOFieldPackager { @Override public int unpack(final ISOComponent c, final byte[] b, final int offset) throws ISOException { final String asciiResult = ISOUtil.ebcdicToAscii(b, offset, LENGTH_BYTE_LENGTH); final int len = Integer.parseInt(asciiResult) - TAG_BYTE_LENGTH; if (!(c instanceof ISOField)) throw new ISOException(c.getClass() .getName() + " is not an ISOField"); c.setFieldNumber(Integer.parseInt(ISOUtil.ebcdicToAscii(b, offset + LENGTH_BYTE_LENGTH, TAG_BYTE_LENGTH))); c.setValue(ISOUtil.ebcdicToAscii(b, offset + TAG_HEADER_LENGTH, len)); return len + 5; } IFELPE_LLLCHAR();  IFELPE_LLLCHAR(int len, String description); @Override byte[] pack(final ISOComponent c); @Override int unpack(final ISOComponent c, final byte[] b, final int offset); @Override void unpack(final ISOComponent c, final InputStream in); @Override int getMaxPackedLength(); }
IFELPE_LLLCHAR extends ISOFieldPackager { @Override public int unpack(final ISOComponent c, final byte[] b, final int offset) throws ISOException { final String asciiResult = ISOUtil.ebcdicToAscii(b, offset, LENGTH_BYTE_LENGTH); final int len = Integer.parseInt(asciiResult) - TAG_BYTE_LENGTH; if (!(c instanceof ISOField)) throw new ISOException(c.getClass() .getName() + " is not an ISOField"); c.setFieldNumber(Integer.parseInt(ISOUtil.ebcdicToAscii(b, offset + LENGTH_BYTE_LENGTH, TAG_BYTE_LENGTH))); c.setValue(ISOUtil.ebcdicToAscii(b, offset + TAG_HEADER_LENGTH, len)); return len + 5; } IFELPE_LLLCHAR();  IFELPE_LLLCHAR(int len, String description); @Override byte[] pack(final ISOComponent c); @Override int unpack(final ISOComponent c, final byte[] b, final int offset); @Override void unpack(final ISOComponent c, final InputStream in); @Override int getMaxPackedLength();  }