Reputation: 385
Basically, I'm trying to find a way to download files with Java Apache IO Commons and have a swing progress bar. I know how to download URL to file, using FileUtils.copyUrlToFile();
and such, but how would I add a progress bar?
Upvotes: 1
Views: 2118
Reputation: 81
Commons IO 2.0 and above do have copyInputStreamToFile(InputStream source, File destination), so you can use ProgressMonitorInputStream.
Upvotes: 4
Reputation: 168845
Since none of the methods of FileUtils
accept an InputStream
we can't use ProgressMonitorInputStream
, and I can't see any other way into that API that would give info. on progress, I think this idea is a non-starter. It cannot be done.
Unless you are referring to copying multiple resources from URL
(s) to File
(s), then we could at least offer the progress of the group (e.g. "3 out of total of 5 files copied").
Upvotes: 2