|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
convert hexa to string |
« View previous topic :: View next topic » |
Author |
Message
|
earrieta |
Posted: Mon Nov 03, 2008 2:29 pm Post subject: convert hexa to string |
|
|
Newbie
Joined: 20 Jun 2008 Posts: 9
|
message id and correlid en format hexa, convert to string |
|
Back to top |
|
 |
bruce2359 |
Posted: Mon Nov 03, 2008 3:18 pm Post subject: |
|
|
 Poobah
Joined: 05 Jan 2008 Posts: 9469 Location: US: west coast, almost. Otherwise, enroute.
|
MSGID and CORRELID are not character fields; rather, they are MQBYTE24 fields, which means that they are just 24 bytes of bits, and do not have a character representation. _________________ I like deadlines. I like to wave as they pass by.
ב''ה
Lex Orandi, Lex Credendi, Lex Vivendi. As we Worship, So we Believe, So we Live. |
|
Back to top |
|
 |
fjb_saper |
Posted: Mon Nov 03, 2008 3:35 pm Post subject: Re: convert hexa to string |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
earrieta wrote: |
message id and correlid en format hexa, convert to string |
There are numerous programs on google showing how to represent the value of a byte as a hex string from 00 to FF.
You cannot convert the byte array to a string you can only represent it in a string form (00-FF)
Enjoy  _________________ MQ & Broker admin |
|
Back to top |
|
 |
atheek |
Posted: Mon Nov 03, 2008 4:39 pm Post subject: |
|
|
 Partisan
Joined: 01 Jun 2006 Posts: 327 Location: Sydney
|
|
Back to top |
|
 |
bower5932 |
Posted: Tue Nov 04, 2008 5:29 am Post subject: |
|
|
 Jedi Knight
Joined: 27 Aug 2001 Posts: 3023 Location: Dallas, TX, USA
|
The amqsbcg sample program dumps the message id and correlation id out. You might want to look at it as well. |
|
Back to top |
|
 |
gs |
Posted: Tue Nov 11, 2008 1:02 am Post subject: |
|
|
 Master
Joined: 31 May 2007 Posts: 254 Location: Sweden
|
The example in the linked thread was kind of messy so here's an easier way to do it (where b[] is your byte array of any size):
Code: |
String msgId = "";
for (int i = 0; i < b.length; i++) {
msgId += Integer.toHexString((b[i] & 0xff) + 0x100).substring(1);
} |
The 0x100 add & substring is to deal with leading zeroes which toHexString strips. |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|