Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

writing .zip file into DataOutputStream

 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 9298
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic