Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

help for transfering of IO Stream  RSS feed

 
pang lf
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
this morning,i write a program about file transfering,it be used copy files about 100M
from a computer of netware to my computer,my
god,it tooks me about 20 minutes,why so slow?
what is it relative to?thanks.
 
Jim Yingst
Wanderer
Sheriff
Posts: 18671
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not sure what a "computer of netware" is. What sort of connection do you have to this computer? It's not, say, a phone modem, is it?
Assuming the connection isn't the problem, how are you performing the copy? Probably you should be using a BufferedInputStream and BufferedOutputStream, and using the read(byte[]) and write(byte[], int, int) methods for efficiency. If you're using RandomAccessFile, burn it - it's evil. Or if you're using Java 1.4, you can check out the new java.nio classes, which may be faster - I haven't really tried them yet.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!