Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Send and receive a zipped file with a character/text stream??

Hugo TigreJan 14 2009 — edited Jan 20 2009
Hi,

Currently i need to configure my software to receive a zip file that is sent to me through sockets, i have no control over the senders application, but what i have discover so far is that it sends everything in text (even the binaries numbers that is supposed to send is sending then in text).

I manage to work around this on everything except the file, i tested with a txt file (the senders application sends both a txt and a zip file) and it works great, but with a zip file, does not.

I think the problem may be with the character set, but i have no idea how to test or work around this.

I don't need to unzip the file or anything, just save the file, theoretically if the file was sent to me using a primitive type data stream i could receive the file the same way even if i couldn't read what was inside the file.

Right now i'm reading the file with a InputSteamReader, saving the data in a char array, and saving the file with:
PrintWriter fileOut = new PrintWriter(new FileOutputStream("c:\\some_dir\\"+fileName));
I receive the complete file, and can save it in the hardrive, but the zip integrity is compromised (damaged zip archive).

Any Ideas?

Any help would be appreciated, if i wasn't clear enough or more input is needed, please tell me.

Best Regards
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 17 2009
Added on Jan 14 2009
30 comments
572 views