HEX Packager

50 views
Skip to first unread message

Meldri Asan

unread,
May 30, 2017, 12:21:47 AM5/30/17
to jPOS Users
Hi All,

I need a packager that show message length + data (in Hex) and have capacity 999. I have try LLLNUM , LLLCHAR and LLHEX. But i didnt get the answer.
This is RAW data message from POS Unit,
018008080998000010FFFF0021

What i need:
0013    + 018008080998000010FFFF0021
Length                    Data (in Hex)

The closest answer was LLLNUM and the result was 0026001301800808099800001076760021
What i get:
26       + 01800808099800001076760021
Length                   Data           

Hope you guys can give some advice to determine what packager i should use.


Thanks.
Meldri     

chhil

unread,
May 30, 2017, 1:50:57 AM5/30/17
to jpos-...@googlegroups.com
import org.jpos.iso.IFB_LLBINARY;
import org.jpos.iso.ISOBinaryField;
import org.jpos.iso.ISOException;
import org.jpos.iso.ISOUtil;

public class Test {

    public static void main(String[] args) throws ISOException {

        byte[] origin = ISOUtil.hex2byte("018008080998000010FFFF0021");
        ISOBinaryField f = new ISOBinaryField(12, origin);
        IFB_LLBINARY packager = new IFB_LLBINARY(10,
                "Should be 0000  13 01 80 08 08 09 98 00  00 10 FF FF 00 21        .............!");
        byte[] x = packager.pack(f);
        System.out.println(ISOUtil.hexdump(x));

    }
}

--
--
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
---
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+unsubscribe@googlegroups.com.
To post to this group, send email to jpos-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jpos-users/42b0e683-e558-459d-ac96-48c36915b758%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Meldri Asan

unread,
May 30, 2017, 9:25:33 PM5/30/17
to jPOS Users
Hi Chhil,

Thanks for save my day. 
But if i want use that data again, i must convert back to Hex again right?

Meldri

chhil

unread,
May 31, 2017, 12:53:42 AM5/31/17
to jpos-...@googlegroups.com
My example may be incorrect.
Should the length be as ascii 4 as in 00 13 which would go on the wire as hex 30 30 31 33
or go on the wire as hex 00 13.

Usually binary is used you need to translate that data according to your needs. You get bytes and what you do with your bytes is upto you.

-chhil

--
--
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
---
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+unsubscribe@googlegroups.com.
To post to this group, send email to jpos-...@googlegroups.com.

Meldri Asan

unread,
Jun 4, 2017, 8:58:08 PM6/4/17
to jPOS Users
Hi Chill,

Thanks..I got it now.

Meldri
Reply all
Reply to author
Forward
0 new messages