@Test public void testPack() throws ISOException { assertArrayEquals(PACKED, m.pack(), "Expected image"); }
@Override public byte[] pack(ISOComponent c) throws ISOException { ByteArrayOutputStream baos = new ByteArrayOutputStream(); try { if (c instanceof ISOMsg) { ISOMsg m = (ISOMsg)c; ISOPackager p = m.getPackager(); m.setPackager(null); ObjectOutputStream os = new ObjectOutputStream(baos); ((Externalizable)c).writeExternal(os); os.flush(); m.setPackager(p); } } catch (IOException e) { throw new ISOException (e); } return baos.toByteArray(); }
NativePackager implements ISOPackager { @Override public byte[] pack(ISOComponent c) throws ISOException { ByteArrayOutputStream baos = new ByteArrayOutputStream(); try { if (c instanceof ISOMsg) { ISOMsg m = (ISOMsg)c; ISOPackager p = m.getPackager(); m.setPackager(null); ObjectOutputStream os = new ObjectOutputStream(baos); ((Externalizable)c).writeExternal(os); os.flush(); m.setPackager(p); } } catch (IOException e) { throw new ISOException (e); } return baos.toByteArray(); } }
NativePackager implements ISOPackager { @Override public byte[] pack(ISOComponent c) throws ISOException { ByteArrayOutputStream baos = new ByteArrayOutputStream(); try { if (c instanceof ISOMsg) { ISOMsg m = (ISOMsg)c; ISOPackager p = m.getPackager(); m.setPackager(null); ObjectOutputStream os = new ObjectOutputStream(baos); ((Externalizable)c).writeExternal(os); os.flush(); m.setPackager(p); } } catch (IOException e) { throw new ISOException (e); } return baos.toByteArray(); }  }
NativePackager implements ISOPackager { @Override public byte[] pack(ISOComponent c) throws ISOException { ByteArrayOutputStream baos = new ByteArrayOutputStream(); try { if (c instanceof ISOMsg) { ISOMsg m = (ISOMsg)c; ISOPackager p = m.getPackager(); m.setPackager(null); ObjectOutputStream os = new ObjectOutputStream(baos); ((Externalizable)c).writeExternal(os); os.flush(); m.setPackager(p); } } catch (IOException e) { throw new ISOException (e); } return baos.toByteArray(); }  @Override byte[] pack(ISOComponent c); @Override int unpack(ISOComponent m, byte[] b); @Override void unpack(ISOComponent m, InputStream in); @Override String getDescription(); @Override String getFieldDescription(ISOComponent m, int fldNumber); @Override ISOMsg createISOMsg(); }
NativePackager implements ISOPackager { @Override public byte[] pack(ISOComponent c) throws ISOException { ByteArrayOutputStream baos = new ByteArrayOutputStream(); try { if (c instanceof ISOMsg) { ISOMsg m = (ISOMsg)c; ISOPackager p = m.getPackager(); m.setPackager(null); ObjectOutputStream os = new ObjectOutputStream(baos); ((Externalizable)c).writeExternal(os); os.flush(); m.setPackager(p); } } catch (IOException e) { throw new ISOException (e); } return baos.toByteArray(); }  @Override byte[] pack(ISOComponent c); @Override int unpack(ISOComponent m, byte[] b); @Override void unpack(ISOComponent m, InputStream in); @Override String getDescription(); @Override String getFieldDescription(ISOComponent m, int fldNumber); @Override ISOMsg createISOMsg();  }