Author |
Message
|
Blackberry |
Posted: Fri Jul 21, 2006 3:54 am Post subject: Facing problem using readUTF |
|
|
Apprentice
Joined: 12 Jul 2006 Posts: 28
|
Hi,
I am new to this technology. Can any one help me?
I am trying to read a message from Queue using MQMessage.readUTF() method. I am using base java and queue is opened using option MQC.MQOO_INPUT_SHARED.I am using default get message options.
The Exception i have received when i am trying to get the message content using MQMessage.readUTF() is
"An IOException occured whilst writing to the message buffer: java.io.EOFException"
But MQMessage.readLine() is working fine.
Thanks in advance
Blackberry |
|
Back to top |
|
 |
bower5932 |
Posted: Fri Jul 21, 2006 4:04 am Post subject: |
|
|
 Jedi Knight
Joined: 27 Aug 2001 Posts: 3023 Location: Dallas, TX, USA
|
Did you write your message using writeUTF? The UTF methods have a length at the front of the data. |
|
Back to top |
|
 |
Blackberry |
Posted: Fri Jul 21, 2006 4:17 am Post subject: |
|
|
Apprentice
Joined: 12 Jul 2006 Posts: 28
|
Yes i am using the MQMessage.writeUTF() method to write the whole string content of a file.
Here is my writeQueue code
Code: |
MQMessage msg = new MQMessage();
msg.writeUTF(freader.getFileContent("C:\\input\\CLEAN_AP010_INPUT1A.txt")); |
freader.getFileContent(String ) method is reading String content of a file. |
|
Back to top |
|
 |
Blackberry |
Posted: Fri Jul 21, 2006 4:53 am Post subject: |
|
|
Apprentice
Joined: 12 Jul 2006 Posts: 28
|
There is NO length parameter in the writeUTF() method.
The signature is like that
Code: |
public void writeUTF(String str) throws IOException; |
can any one help? |
|
Back to top |
|
 |
bower5932 |
Posted: Fri Jul 21, 2006 6:06 am Post subject: |
|
|
 Jedi Knight
Joined: 27 Aug 2001 Posts: 3023 Location: Dallas, TX, USA
|
From the Using Java manual:
Quote: |
The writeUTF() method of MQMessage automatically encodes the length of the string as well as the Unicode bytes it contains. When your message will be read by another Java program (using readUTF()), this is the simplest way to send string information. |
How big is your file? I believe the limit of a UTF message is 64K. |
|
Back to top |
|
 |
|