wood burning stoves 2.0*
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 The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "writing .zip file into DataOutputStream" Watch "writing .zip file into DataOutputStream" New topic
Author

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\\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
Bartender

Joined: Oct 29, 2001
Posts: 8876
    
    8

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.

DataOutputStream

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.


"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
 
Consider Paul's rocket mass heater.
 
subject: writing .zip file into DataOutputStream