2

I've written a code using Swing for a GUI interface and a Swingworker which handles download using a Sync client.

this is what the doInBackground() method of the worker should to:

1)acknowledge a label with the current file to download 2)download that file.

   for (HashMap.Entry<String, Long> s: DCPFiles.entrySet()) {


          jLabel5.setText("Download file " + Integer.toString(directory.listFiles().length + 1) + " di " + Integer.toString(nFilesDCP) + " del DCP    "+ DCPname); 


s3.getObject(GetObjectRequest.builder().bucket(bucketName)
.key(s.getKey()).build(),
ResponseTransformer.toFile(Paths.get(path.getPath()+ "\\" + s.getKey())));     




           }

I have also a progressbar in the GUI interface I would acknowledge with progress. Since there's no progresslistener yet in aws-java-sdk-v2 I could poll on partially downloaded file size and divide by theexpected size to update progressbar. But how to do it? a While Cycle on s3.getObject ? And on which condition?

Thanks in advance-

madhead
  • 31,729
  • 16
  • 153
  • 201
edo1080
  • 61
  • 7

0 Answers0