my dog learned polymorphism
The moose likes I/O and Streams and the fly likes writing .zip file into DataOutputStream Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "writing .zip file into DataOutputStream" Watch "writing .zip file into DataOutputStream" New topic

writing .zip file into DataOutputStream

Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

Hi Folks,

my zip file is in my hard disk ("E:\\out_zip\\") . i need to send this .zip file to the ServerSocket . so how can i write it into the DataOutputStream ? please can you tell me the way?
Joe Ess

Joined: Oct 29, 2001
Posts: 9191

DataOutputStream is a bad choice for writing a binary file:
A data output stream lets an application write primitive Java data types to an output stream in a portable way. An application can then use a data input stream to read the data back in.


The cool thing about Java IO is that copying to a socket is the same as copying to a file or a pipe and so on. Have a look at this example.

[How To Ask Questions On JavaRanch]
I agree. Here's the link:
subject: writing .zip file into DataOutputStream
It's not a secret anymore!