@Test public void testUnpack() throws Throwable { Base1SubFieldPackager base1SubFieldPackager = new Base1SubFieldPackager(); ISOFieldPackager[] fld = new ISOFieldPackager[3]; base1SubFieldPackager.setFieldPackager(fld); base1SubFieldPackager.setLogger(new Logger(), "testBase1SubFieldPackagerRealm"); byte[] b = new byte[0]; int result = base1SubFieldPackager.unpack(new ISOMsg(100), b); assertEquals(0, result, "result"); }
public int unpack (ISOComponent m, byte[] b) throws ISOException { LogEvent evt = new LogEvent (this, "unpack"); try { if (m.getComposite() != m) throw new ISOException ("Can't call packager on non Composite"); if (logger != null) evt.addMessage (ISOUtil.hexString (b)); int consumed=0; ISOBitMap bitmap = new ISOBitMap (-1); BitSet bmap = null; int maxField = fld.length; if (emitBitMap()) { consumed += getBitMapfieldPackager().unpack(bitmap,b,consumed); bmap = (BitSet) bitmap.getValue(); m.set (bitmap); maxField = bmap.size(); } for (int i=getFirstField(); i<maxField && consumed < b.length; i++) { if (bmap == null || bmap.get(i)) { ISOComponent c = fld[i].createComponent(i); consumed += fld[i].unpack (c, b, consumed); m.set(c); } } if (b.length != consumed) { evt.addMessage ( "WARNING: unpack len=" +b.length +" consumed=" +consumed); } return consumed; } catch (ISOException e) { evt.addMessage (e); throw e; } finally { Logger.log (evt); } }
Base1SubFieldPackager extends ISOBasePackager { public int unpack (ISOComponent m, byte[] b) throws ISOException { LogEvent evt = new LogEvent (this, "unpack"); try { if (m.getComposite() != m) throw new ISOException ("Can't call packager on non Composite"); if (logger != null) evt.addMessage (ISOUtil.hexString (b)); int consumed=0; ISOBitMap bitmap = new ISOBitMap (-1); BitSet bmap = null; int maxField = fld.length; if (emitBitMap()) { consumed += getBitMapfieldPackager().unpack(bitmap,b,consumed); bmap = (BitSet) bitmap.getValue(); m.set (bitmap); maxField = bmap.size(); } for (int i=getFirstField(); i<maxField && consumed < b.length; i++) { if (bmap == null || bmap.get(i)) { ISOComponent c = fld[i].createComponent(i); consumed += fld[i].unpack (c, b, consumed); m.set(c); } } if (b.length != consumed) { evt.addMessage ( "WARNING: unpack len=" +b.length +" consumed=" +consumed); } return consumed; } catch (ISOException e) { evt.addMessage (e); throw e; } finally { Logger.log (evt); } } }
Base1SubFieldPackager extends ISOBasePackager { public int unpack (ISOComponent m, byte[] b) throws ISOException { LogEvent evt = new LogEvent (this, "unpack"); try { if (m.getComposite() != m) throw new ISOException ("Can't call packager on non Composite"); if (logger != null) evt.addMessage (ISOUtil.hexString (b)); int consumed=0; ISOBitMap bitmap = new ISOBitMap (-1); BitSet bmap = null; int maxField = fld.length; if (emitBitMap()) { consumed += getBitMapfieldPackager().unpack(bitmap,b,consumed); bmap = (BitSet) bitmap.getValue(); m.set (bitmap); maxField = bmap.size(); } for (int i=getFirstField(); i<maxField && consumed < b.length; i++) { if (bmap == null || bmap.get(i)) { ISOComponent c = fld[i].createComponent(i); consumed += fld[i].unpack (c, b, consumed); m.set(c); } } if (b.length != consumed) { evt.addMessage ( "WARNING: unpack len=" +b.length +" consumed=" +consumed); } return consumed; } catch (ISOException e) { evt.addMessage (e); throw e; } finally { Logger.log (evt); } }  }
Base1SubFieldPackager extends ISOBasePackager { public int unpack (ISOComponent m, byte[] b) throws ISOException { LogEvent evt = new LogEvent (this, "unpack"); try { if (m.getComposite() != m) throw new ISOException ("Can't call packager on non Composite"); if (logger != null) evt.addMessage (ISOUtil.hexString (b)); int consumed=0; ISOBitMap bitmap = new ISOBitMap (-1); BitSet bmap = null; int maxField = fld.length; if (emitBitMap()) { consumed += getBitMapfieldPackager().unpack(bitmap,b,consumed); bmap = (BitSet) bitmap.getValue(); m.set (bitmap); maxField = bmap.size(); } for (int i=getFirstField(); i<maxField && consumed < b.length; i++) { if (bmap == null || bmap.get(i)) { ISOComponent c = fld[i].createComponent(i); consumed += fld[i].unpack (c, b, consumed); m.set(c); } } if (b.length != consumed) { evt.addMessage ( "WARNING: unpack len=" +b.length +" consumed=" +consumed); } return consumed; } catch (ISOException e) { evt.addMessage (e); throw e; } finally { Logger.log (evt); } }  int unpack(ISOComponent m, byte[] b); @Override byte[] pack(ISOComponent m); }
Base1SubFieldPackager extends ISOBasePackager { public int unpack (ISOComponent m, byte[] b) throws ISOException { LogEvent evt = new LogEvent (this, "unpack"); try { if (m.getComposite() != m) throw new ISOException ("Can't call packager on non Composite"); if (logger != null) evt.addMessage (ISOUtil.hexString (b)); int consumed=0; ISOBitMap bitmap = new ISOBitMap (-1); BitSet bmap = null; int maxField = fld.length; if (emitBitMap()) { consumed += getBitMapfieldPackager().unpack(bitmap,b,consumed); bmap = (BitSet) bitmap.getValue(); m.set (bitmap); maxField = bmap.size(); } for (int i=getFirstField(); i<maxField && consumed < b.length; i++) { if (bmap == null || bmap.get(i)) { ISOComponent c = fld[i].createComponent(i); consumed += fld[i].unpack (c, b, consumed); m.set(c); } } if (b.length != consumed) { evt.addMessage ( "WARNING: unpack len=" +b.length +" consumed=" +consumed); } return consumed; } catch (ISOException e) { evt.addMessage (e); throw e; } finally { Logger.log (evt); } }  int unpack(ISOComponent m, byte[] b); @Override byte[] pack(ISOComponent m);  }