@Test public void testPack() throws Exception { ISOBinaryField field = new ISOBinaryField(12, new byte[] {0x12, 0x34}); IFB_LLHFBINARY packager = new IFB_LLHFBINARY(4, "Should be 1234"); TestUtils.assertEquals(new byte[] {0x02, 0x12, 0x34, 0x00, 0x00}, packager.pack(field)); }
public byte[] pack (ISOComponent c) throws ISOException { int len = ((byte[]) c.getValue()).length; if (len > getLength() || len>255) { throw new ISOException ( "invalid len "+len +" packing field "+ c.getKey() ); } byte[] b = new byte[getLength() + 1]; b[0] = (byte) len; System.arraycopy(c.getValue(), 0, b, 1, len); return b; }
IFB_LLHFBINARY extends ISOFieldPackager { public byte[] pack (ISOComponent c) throws ISOException { int len = ((byte[]) c.getValue()).length; if (len > getLength() || len>255) { throw new ISOException ( "invalid len "+len +" packing field "+ c.getKey() ); } byte[] b = new byte[getLength() + 1]; b[0] = (byte) len; System.arraycopy(c.getValue(), 0, b, 1, len); return b; } }
IFB_LLHFBINARY extends ISOFieldPackager { public byte[] pack (ISOComponent c) throws ISOException { int len = ((byte[]) c.getValue()).length; if (len > getLength() || len>255) { throw new ISOException ( "invalid len "+len +" packing field "+ c.getKey() ); } byte[] b = new byte[getLength() + 1]; b[0] = (byte) len; System.arraycopy(c.getValue(), 0, b, 1, len); return b; } IFB_LLHFBINARY();  IFB_LLHFBINARY(int len, String description); }
IFB_LLHFBINARY extends ISOFieldPackager { public byte[] pack (ISOComponent c) throws ISOException { int len = ((byte[]) c.getValue()).length; if (len > getLength() || len>255) { throw new ISOException ( "invalid len "+len +" packing field "+ c.getKey() ); } byte[] b = new byte[getLength() + 1]; b[0] = (byte) len; System.arraycopy(c.getValue(), 0, b, 1, len); return b; } IFB_LLHFBINARY();  IFB_LLHFBINARY(int len, String description); byte[] pack(ISOComponent c); int unpack(ISOComponent c, byte[] b, int offset); void unpack(ISOComponent c, InputStream in); ISOComponent createComponent(int fieldNumber); int getMaxPackedLength(); }
IFB_LLHFBINARY extends ISOFieldPackager { public byte[] pack (ISOComponent c) throws ISOException { int len = ((byte[]) c.getValue()).length; if (len > getLength() || len>255) { throw new ISOException ( "invalid len "+len +" packing field "+ c.getKey() ); } byte[] b = new byte[getLength() + 1]; b[0] = (byte) len; System.arraycopy(c.getValue(), 0, b, 1, len); return b; } IFB_LLHFBINARY();  IFB_LLHFBINARY(int len, String description); byte[] pack(ISOComponent c); int unpack(ISOComponent c, byte[] b, int offset); void unpack(ISOComponent c, InputStream in); ISOComponent createComponent(int fieldNumber); int getMaxPackedLength();  }