Author |
Message
|
ranjith |
Posted: Tue Apr 19, 2005 10:24 pm Post subject: file transfer |
|
|
Apprentice
Joined: 04 May 2004 Posts: 25
|
I am putting a message to a queue q1 from a file
The contents of the file is given below
text1
text2
text3
next i am trying to get the message from the same queue q1 and i tried
to write into the file to different location.the content of the file is coming in the same line where i am expecting in the three lines(newline is not coming)text1 text2 text3
note:this problem is coming in the notepad but in editplus the contents is coming properly what i expected..
please help me out how to get the data in notepad properly
[/img] |
|
Back to top |
|
 |
Michael Dag |
Posted: Wed Apr 20, 2005 2:08 am Post subject: |
|
|
 Jedi Knight
Joined: 13 Jun 2002 Posts: 2607 Location: The Netherlands (Amsterdam)
|
is the data ok before you put it?
notepad does not handle \n versus \r\n well, use wordpad... _________________ Michael
MQSystems Facebook page |
|
Back to top |
|
 |
ranjith |
Posted: Wed Apr 20, 2005 2:47 am Post subject: |
|
|
Apprentice
Joined: 04 May 2004 Posts: 25
|
Michael
actually we need to send the file to third party...they are opening file in the notepad for their activity..
is there any way to get the data exactly in the notepad from the queue
Thanks |
|
Back to top |
|
 |
Michael Dag |
Posted: Wed Apr 20, 2005 2:49 am Post subject: |
|
|
 Jedi Knight
Joined: 13 Jun 2002 Posts: 2607 Location: The Netherlands (Amsterdam)
|
write crlf instead of lf or 0D0A instead of 0A or \r\n instead of \n _________________ Michael
MQSystems Facebook page |
|
Back to top |
|
 |
ranjith |
Posted: Wed Apr 20, 2005 3:04 am Post subject: |
|
|
Apprentice
Joined: 04 May 2004 Posts: 25
|
we are reading the file in bytes and putting into the queue..
here how can we change crlf instead of lf or 0D0A instead of 0A or \r\n instead of \n |
|
Back to top |
|
 |
ranjith |
Posted: Wed Apr 20, 2005 3:51 am Post subject: |
|
|
Apprentice
Joined: 04 May 2004 Posts: 25
|
posting the output of amqsbcg
OPEN - 'hhtq'
GET of message number 1
****Message descriptor****
StrucId : 'MD ' Version : 2
Report : 0 MsgType : 8
Expiry : -1 Feedback : 0
Encoding : 273 CodedCharSetId : 819
Format : 'MQSTR '
Priority : 0 Persistence : 0
MsgId : X'414D5120484854202020202020202020C0AD294120000D01'
CorrelId : X'000000000000000000000000000000000000000000000000'
BackoutCount : 0
ReplyToQ : ' '
ReplyToQMgr : 'HHT '
** Identity Context
UserIdentifier : 'MUSR_MQADMIN'
Accounting Token :
X'16010515000000CD7C41668177D974828BA628F803000000000000000000000B'
ApplIdentityData : ' '
** Origin Context
PutApplType : '28'
PutApplName : 'MQSeries Client for Java '
PutDate : '20040823' PutTime : '11475601'
ApplOriginData : ' '
GroupId : X'000000000000000000000000000000000000000000000000'
MsgSeqNumber : '1'
Offset : '0'
MsgFlags : '0'
OriginalLength : '-1'
**** Message ****
length - 100 bytes
00000000: 626C 6275 6621 2121 2121 4848 5431 2121 'blbuf!!!!!HHT1!!'
00000010: 2121 2121 3131 3132 3232 3333 3332 3232 '!!!!111222333222'
00000020: 3131 3174 6573 7421 2121 2121 2121 2121 '111test!!!!!!!!!'
00000030: 2121 2121 2121 2121 2121 2121 3131 3232 '!!!!!!!!!!!!1122'
00000040: 3333 3232 3131 7478 7421 2172 616E 6A69 '332211txt!!ranji'
00000050: 7468 0A0A 0A0A 7072 6174 696B 0A72 616A 'th....pratik.raj'
00000060: 6573 680A 'esh. '
No more messages
CLOSE of queue
DISCONNECT from queue manager
**************************
please help
Thanks |
|
Back to top |
|
 |
jefflowrey |
Posted: Wed Apr 20, 2005 4:06 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
You don't appear to have any line endings in your message.
What is the code for reading the file and writing the message? _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
ranjith |
Posted: Wed Apr 20, 2005 4:22 am Post subject: |
|
|
Apprentice
Joined: 04 May 2004 Posts: 25
|
code for reading the file..
public byte[] readFileBytes(File sourceFile)
throws ImageSenderException
{
String source = "readFileBytes() - FileSystemHelper";
FileInputStream ipStream = null;
byte bytes[] = null;
try
{
ipStream = new FileInputStream(sourceFile);
int fileLength = (int) sourceFile.length();
bytes = new byte[fileLength];
ipStream.read(bytes,0,fileLength);
}
catch(FileNotFoundException fnfe)
{
logger.write(Logger.MSG_ERR,source,"could not find file to copy. message - "+fnfe);
ImageSenderException ex = new ImageSenderException("Could not find file to copy.",false);
throw ex;
}
catch(IOException ioe)
{
logger.write(Logger.MSG_ERR,source,"could not copy the file. message - "+ioe);
ImageSenderException ex = new ImageSenderException("Could not copy the file.",false);
throw ex;
}
finally
{
try
{
if (ipStream != null)
{
ipStream.close();
}
}
catch(IOException ioe)
{
}
}
return bytes;
}
and code for writing the message into the queue is
MQMessage message = new MQMessage();
message.format = MQC.MQFMT_STRING;
String msg = "B" + barcode + magicNumber + fileExt;
try
{
message.writeString(msg);
message.write(fileBytes);
}
i am using AIX..
Thanks |
|
Back to top |
|
 |
vennela |
Posted: Wed Apr 20, 2005 6:08 am Post subject: |
|
|
 Jedi Knight
Joined: 11 Aug 2002 Posts: 4055 Location: Hyderabad, India
|
Can you open the file using notepad on the source side? And when you do how does it show up?
Edit:
Never mind:
Assume the files are text files maybe you should change your program to read it as string instead of bytes and see if that helps. |
|
Back to top |
|
 |
|