@Test public void testPack() throws Exception { ISOField field = new ISOField(92, "123"); IFELPE_LLLCHAR packager = new IFELPE_LLLCHAR(92, "Should be F0F0F5F9F2F1F2F3"); TestUtils.assertEquals(new byte[] {(byte)0xF0, (byte)0xF0,(byte)0xf5, (byte)0xF9, (byte)0xF2, (byte)0xF1, (byte)0xF2, (byte)0xF3}, packager.pack(field)); }
@Override public byte[] pack(final ISOComponent c) throws ISOException { final String s = (String) c.getValue(); final int len = s.length(); final byte[] payload = new byte[len + TAG_HEADER_LENGTH]; final String tagHeader = ISOUtil.zeropad(Integer.toString(len + TAG_BYTE_LENGTH), LENGTH_BYTE_LENGTH) + ISOUtil.zeropad(c.getKey().toString(), TAG_BYTE_LENGTH); System.arraycopy(ISOUtil.asciiToEbcdic(tagHeader), 0, payload, 0, TAG_HEADER_LENGTH); System.arraycopy(ISOUtil.asciiToEbcdic(s), 0, payload, TAG_HEADER_LENGTH, len); return payload; }
IFELPE_LLLCHAR extends ISOFieldPackager { @Override public byte[] pack(final ISOComponent c) throws ISOException { final String s = (String) c.getValue(); final int len = s.length(); final byte[] payload = new byte[len + TAG_HEADER_LENGTH]; final String tagHeader = ISOUtil.zeropad(Integer.toString(len + TAG_BYTE_LENGTH), LENGTH_BYTE_LENGTH) + ISOUtil.zeropad(c.getKey().toString(), TAG_BYTE_LENGTH); System.arraycopy(ISOUtil.asciiToEbcdic(tagHeader), 0, payload, 0, TAG_HEADER_LENGTH); System.arraycopy(ISOUtil.asciiToEbcdic(s), 0, payload, TAG_HEADER_LENGTH, len); return payload; } }
IFELPE_LLLCHAR extends ISOFieldPackager { @Override public byte[] pack(final ISOComponent c) throws ISOException { final String s = (String) c.getValue(); final int len = s.length(); final byte[] payload = new byte[len + TAG_HEADER_LENGTH]; final String tagHeader = ISOUtil.zeropad(Integer.toString(len + TAG_BYTE_LENGTH), LENGTH_BYTE_LENGTH) + ISOUtil.zeropad(c.getKey().toString(), TAG_BYTE_LENGTH); System.arraycopy(ISOUtil.asciiToEbcdic(tagHeader), 0, payload, 0, TAG_HEADER_LENGTH); System.arraycopy(ISOUtil.asciiToEbcdic(s), 0, payload, TAG_HEADER_LENGTH, len); return payload; } IFELPE_LLLCHAR();  IFELPE_LLLCHAR(int len, String description); }
IFELPE_LLLCHAR extends ISOFieldPackager { @Override public byte[] pack(final ISOComponent c) throws ISOException { final String s = (String) c.getValue(); final int len = s.length(); final byte[] payload = new byte[len + TAG_HEADER_LENGTH]; final String tagHeader = ISOUtil.zeropad(Integer.toString(len + TAG_BYTE_LENGTH), LENGTH_BYTE_LENGTH) + ISOUtil.zeropad(c.getKey().toString(), TAG_BYTE_LENGTH); System.arraycopy(ISOUtil.asciiToEbcdic(tagHeader), 0, payload, 0, TAG_HEADER_LENGTH); System.arraycopy(ISOUtil.asciiToEbcdic(s), 0, payload, TAG_HEADER_LENGTH, len); return payload; } 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 byte[] pack(final ISOComponent c) throws ISOException { final String s = (String) c.getValue(); final int len = s.length(); final byte[] payload = new byte[len + TAG_HEADER_LENGTH]; final String tagHeader = ISOUtil.zeropad(Integer.toString(len + TAG_BYTE_LENGTH), LENGTH_BYTE_LENGTH) + ISOUtil.zeropad(c.getKey().toString(), TAG_BYTE_LENGTH); System.arraycopy(ISOUtil.asciiToEbcdic(tagHeader), 0, payload, 0, TAG_HEADER_LENGTH); System.arraycopy(ISOUtil.asciiToEbcdic(s), 0, payload, TAG_HEADER_LENGTH, len); return payload; } 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();  }