• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to download files from pc to pc

 
Maged Roshdy
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all
in a filesharing program supose i'm a client and i want to download a file from someone
what is the type of Streams that i use to be suitable to copy all kinds of files
is it DataOutputStream
or OutputStreamWriter
or FileWriter
or PrintWriter
and which method should i use ?
i've tried
DataInputStream and DataOutputStream
with the methods
readByte() & writeByte()
and it works but with the problem that the file that has copied is not opened properly
 
Pavel Halas
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

i've tried
DataInputStream and DataOutputStream
with the methods
readByte() & writeByte()

Sorry, you're wrong. This should be used when you want to store privitives on disk.
Buffered Input/Output Stream is the right answer.
 
jason adam
Chicken Farmer ()
Ranch Hand
Posts: 1932
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Or you could check out the java.nio.channels API. Create a FileInput and FileOutput stream on the two files, get the channel for each, and use transferFrom/transferTo or read(ByteBuffer)/write(ByteBuffer).
 
Brian Wilson
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There many programs used to download files and programs. But I think the most conventional way would be to have your friend copy the file or program onto a CD and you could take a taxi over to his house and pick it up, or have it delivered to your house.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!