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

JProgressBar with file downloads  RSS feed

 
Sloan Bowman
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to figure out to how create a JProgressBar that monitors the progress of a downlaod through ftp. I am using the package from jakarta called commons.net.ftp.FTPClient to download the file. I am able to get the file size with no problems but I can't figure out how to get the current state that the FileOutputStream is in (fileSize of the current download). Any ideas on how to do this?
 
Jim Yingst
Wanderer
Sheriff
Posts: 18671
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can create a FilterInputStream or FilterOutputStream which counts the number of bytes that pass through it. In fact half the work for this is already done for you by CheckedInputStream and CheckedOutputStream - you can just make a single Checksum to count bytes, and then insert a CheckedInputStream or CheckedOutputStream into whatever stream you want to monitor:

[ April 22, 2003: Message edited by: Jim Yingst ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!