This week's giveaway is in the Cloud/Virtualization forum.
We're giving away four copies of Secure Financial Transactions with Ansible, Terraform, and OpenSCAP and have Lucian Maly on-line!
See this thread for details.
Win a copy of Secure Financial Transactions with Ansible, Terraform, and OpenSCAP this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Rob Spoor
  • Henry Wong
  • Liutauras Vilda
Saloon Keepers:
  • Tim Moores
  • Carey Brown
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
Bartenders:
  • Frits Walraven
  • Himai Minh
  • Jj Roberts

How to download files from pc to pc

 
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Chicken Farmer ()
Posts: 1932
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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).
 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
straws are for suckers. tiny ads are for attractive people.
SKIP - a book about connecting industrious people with elderly land owners
https://coderanch.com/t/skip-book
reply
    Bookmark Topic Watch Topic
  • New Topic