Example #1
0
 private void copyEntry(IInputSource source, IOutputTarget target, String entryPath)
     throws CoreException {
   try {
     InputStream in = getInputStream(source, entryPath);
     if (in != null) {
       OutputStream out = getOutputStream(target, entryPath);
       if (out != null) {
         try {
           FileUtils.transfer(in, out, true);
         } finally {
           long time = source.getEntryTime(entryPath);
           if (time >= 0) {
             target.setEntryTime(entryPath, time);
           }
           Exception e2 = checkChecksum(source, entryPath, in, null);
           if (e2 instanceof CoreException) {
             throw (CoreException) e2;
           }
         }
       }
     }
   } catch (IOException e) {
     Core.getLogger().log(e);
   } catch (CoreException e) {
     if (e.getType() == Core.ERROR_WRONG_PASSWORD || e.getType() == Core.ERROR_CANCELLATION)
       throw e;
     Core.getLogger().log(e);
   }
 }
Example #2
0
 private void saveThumbnailFile(File source, File targetFile) {
   try {
     FileUtils.transfer(new FileInputStream(source), new FileOutputStream(targetFile), true);
   } catch (FileNotFoundException e) {
     e.printStackTrace();
   } catch (IOException e) {
     e.printStackTrace();
   }
 }