• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

JProgressBar with file downloads  RSS feed

 
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?
 
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!