-1

I'm trying to work on a simple updater for a project I'm working on and for actually downloading the file I'm using Apache's FileUtils.copyURLToFile method. I'm curious on how I can obtain a download percent while the download is happening (eg: 10%, 20%, 100%).

So of cause all I have so far is:

FileUtils.copyURLToFile(new URL(assets), assetsZip);

Oli
  • 31
  • 4

1 Answers1

1

According to the documentation you can't use FileUtils alone to get this information. Here's what you could do as a high level concept:

In one thread you call this. It will block until it's finished. In another thread you loop and check the size of the file on the file system. downloaded / total file size = % Update the label with this.

Daniel Kaplan
  • 62,768
  • 50
  • 234
  • 356