示例#1
0
 protected Void doInBackground() throws Exception {
   for (int n = 0; n < binaryAndFileList.size(); n++) {
     Map.Entry<Binary, File> binaryAndFile = binaryAndFileList.get(n);
     Binary binary = binaryAndFile.getKey();
     File file = binaryAndFile.getValue();
     setProgress(n + 1, 0, binaryAndFileList.size());
     if (binaryAndFileList.size() == 1) {
       message(getFullResourceKey("progress.singular"), binary.getFileName());
     } else {
       message(
           getFullResourceKey("progress.plural"),
           binary.getFileName(),
           n + 1,
           binaryAndFileList.size());
     }
     InputStream in = null;
     OutputStream out = null;
     try {
       IOUtils.copy(in = binary.getDataStream(), out = new FileOutputStream(file));
       wroteBinaryToFile(binaryAndFile);
     } finally {
       IOUtils.closeQuietly(in);
       IOUtils.closeQuietly(out);
     }
   }
   return null;
 }
示例#2
0
 protected File getTargetFile(final File folder, final Binary binary) {
   return new File(folder, binary.getFileName());
 }