ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » IBM MQ Java / JMS » Getting EOF Exception when using ReadUTF

Post new topic  Reply to topic
 Getting EOF Exception when using ReadUTF « View previous topic :: View next topic » 
Author Message
ramjcp
PostPosted: Mon Jul 23, 2007 2:34 am    Post subject: Getting EOF Exception when using ReadUTF Reply with quote

Newbie

Joined: 23 Jul 2007
Posts: 3

HI All

My requirement is my MQMessage contains some japanese characters,which i need to read it and process it accordingly

so i have developed the following code for but it is not working , i am getting exception
code is
[code]

byte msgBytes[] = null;
int msgLength = 0;
String msgInString = null;


MQGetMessageOptions gmo = new MQGetMessageOptions();
gmo.options = MQC.MQGMO_SYNCPOINT | MQC.MQGMO_WAIT;
MQMessage myMessage = new MQMessage();
queue.get(myMessage, gmo);
msgLength = myMessage.getMessageLength();
msgBytes = new byte[msgLength];
msgInString=myMessage.readUTF();


[/code]

when that last line is getting executed i am getting EOFException.

can any one suggest me how to read japanses characters from MQMessage,
i have tried in another way there is no exception, but the generated string is not japanse. the code i used for it instead of ReadUTF

[code]

myMessage.readFully(msgBytes);
msgInString = new String(msgBytes,"UTF-8");[/code]

i hope that i would get some solution for this...

waiting for reply with anticipation
Back to top
View user's profile Send private message
Vitor
PostPosted: Mon Jul 23, 2007 2:39 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

Was the original message actually written using a UTF method or is it a simple string holding extended Japanese character values?
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Mon Jul 23, 2007 2:43 am    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

You need as well to look at CCSID conversion. Make sure the message has format = MQFMT_STRING. Enjoy
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
ramjcp
PostPosted: Mon Jul 23, 2007 2:50 am    Post subject: Reply with quote

Newbie

Joined: 23 Jul 2007
Posts: 3

its just a simple string containing japanese characters
Back to top
View user's profile Send private message
Vitor
PostPosted: Mon Jul 23, 2007 2:54 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

ramjcp wrote:
its just a simple string containing japanese characters


Then readUTF won't work.

Read it as a string and convert it as fjb_saper correctly suggests.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Mon Jul 23, 2007 2:56 am    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

ramjcp wrote:
its just a simple string containing japanese characters

Make sure your message format is MQFMT_STRING. Make sure the message's CCSID corresponds to the content. Use the CONVERT option with your get. Make sure there is automatic conversion from the source CCSID to the target CCSID. All this being taken care of you should see the japaneese characters...

Enjoy

Between us I would use Unicode (UTF-16) CCSID 1200...
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
ramjcp
PostPosted: Mon Jul 23, 2007 3:35 am    Post subject: Reply with quote

Newbie

Joined: 23 Jul 2007
Posts: 3

can you provide me any sample code or any link , so that i can acheive this
Back to top
View user's profile Send private message
Vitor
PostPosted: Mon Jul 23, 2007 4:13 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

ramjcp wrote:
can you provide me any sample code or any link , so that i can acheive this


Most of the samples employ these options.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ Java / JMS » Getting EOF Exception when using ReadUTF
Jump to:  



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
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.