Re: [jpos-users] Secondary Bitmap is mandatory as per our client system spec

105 views
Skip to first unread message
Message has been deleted

Alejandro Revilla

unread,
Aug 8, 2014, 2:06:05 PM8/8/14
to jPOS Users

I had a similar situation recently and ended up writing a special ISOBitmapPackager implementation. In my case, I was using IFA_BITMAP and replace it with this one:

@SuppressWarnings("unused")
public class IFA_RETARDED_BITMAP extends ISOBitMapPackager {
    public IFA_RETARDED_BITMAP() {
        super();
    }
    /**
     * @param len - field len
     * @param description symbolic descrption
     */
    public IFA_RETARDED_BITMAP(int len, String description) {
        super(len, description);
    }
    /**
     * @param c - a component
     * @return packed component
     * @exception ISOException
     */
    public byte[] pack (ISOComponent c) throws ISOException {
        byte[] b = ISOUtil.bitSet2byte ((BitSet) c.getValue());
        b[0] |= 0x80; // force second bitmap indicator
        StringBuilder sb = new StringBuilder(ISOUtil.hexString(b));
        if (sb.length() == 16)
            sb.append(ISOUtil.zeropad(0L, 16));
        try {
            b = sb.toString().getBytes(ISOUtil.ENCODING);
        } catch (UnsupportedEncodingException ignored) { }
        return b;
    }

    public int getMaxPackedLength() {
        return getLength() >> 2;
    }
    /**
     * @param c - the Component to unpack
     * @param b - binary image
     * @param offset - starting offset within the binary image
     * @return consumed bytes
     * @exception ISOException
     */
    public int unpack (ISOComponent c, byte[] b, int offset)
        throws ISOException
    {
        int len;
        BitSet bmap = ISOUtil.hex2BitSet (b, offset, getLength() << 3);
        c.setValue(bmap);
        len = (bmap.get(1)) ? 128 : 64; /* changed by Hani */
        if (getLength() > 16 && bmap.get(65))
            len = 192;
        return (len >> 2);
    }
    public void unpack (ISOComponent c, InputStream in) 
        throws IOException, ISOException
    {
        BitSet bmap = ISOUtil.hex2BitSet (new BitSet (64), readBytes (in, 16), 0);
        if (getLength() > 8 && bmap.get (1)) {
            ISOUtil.hex2BitSet (bmap, readBytes (in, 16), 64);
        }
        c.setValue(bmap);
    }
}


--
@apr


On Fri, Aug 8, 2014 at 1:26 PM, Dipin C <dipi...@gmail.com> wrote:
Hi team,

I require to form an ISOMsg with secondary bit map with zero's even though i don't have more than 64 elements. As per the system specification it is mandatory to have secondary bitmap. How can I achieve it ? Which function I need to overwrite ?

--
--
jPOS is licensed under AGPL - free for community usage for your open-source project. Licenses are also available for commercial usage. Please support jPOS, contact: sa...@jpos.org
 
Join us in IRC at http://webchat.freenode.net/?channels=jpos
 
You received this message because you are subscribed to the "jPOS Users" group.
Please see http://jpos.org/wiki/JPOS_Mailing_List_Readme_first
To post to this group, send email to jpos-...@googlegroups.com
To unsubscribe, send email to jpos-users+...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/jpos-users
---
You received this message because you are subscribed to the Google Groups "jPOS Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jpos-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jpos-users/08c17c82-9e67-44eb-9d61-1e68729aee1d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Message has been deleted

Alejandro Revilla

unread,
Aug 8, 2014, 2:18:04 PM8/8/14
to jPOS Users
And BTW, feel free to rename the class, I used that name to make my point that this was not a correct implementation of the standard and just to have fun with my client :)

--
@apr


Reply all
Reply to author
Forward
0 new messages