Forums Register Login

Java Mail + ZipOutputStream + XML file

+Pie Number of slices to send: Send
Hi there,

I have a problem where I have to generate an xml file by java application (having main method) on Unix box (accessing through WinSCP) and then zip it by Java ZipEntry and ZipOutputStream classes and then mail the zip file using Java mail API.

Here are the sequence of operation..

1. Generation of xml file
2. Zipping the xml file into a zip file by java ZipOutputStream class.
3. Mail using the Java mail and activation framework.

So far so good. I got the zip file in my outlook mail box as an attachment.


Next I have compared the xml file which I got from mail (extracted it from attached zip) with the xml file which is on Unix box. I simply moved the xml file to windows using WinSCP.


I have found that there are differences in whole file.. however, every line is exactly same but WinMerge is showing differences in every line.


Has anyone faced this problem? What could be the issue here?


Thanks & Regards,
Nazzy
+Pie Number of slices to send: Send
Could be a line break thing. Unix uses \n (line feed), Windows uses \r\n (carriage return + line feed).
+Pie Number of slices to send: Send
Hi Rob,

Thanks for your reply. I was also thinking the same thing that it could be a carriage return issue.

Do you have any idea how we can resolve this problem?

I will also keep you updated if I can find any kind of patching that can be done here to resolve this issue.


Thanks & Kind Regards,
Nazzy
+Pie Number of slices to send: Send
Write-CR-LF-at-end

May be above url will help. Not sure need to check...

I will let you know whether below code resolves or not?




In C/C++, this is done by creating file streams in "translated" mode. No idea how its done in Java.


Thanks,
Nazzy
Let's go to the waterfront with this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 2036 times.
Similar Threads
how to zip file clubbing ZipOutputStream in Buffered writer
Generating XML feed for users.
Upload a file to unix and invoke a java method
Different Checksum values retrieved
Working with Java in UNIX
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 03:21:13.