예제 #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);
   }
 }
예제 #2
0
  private OutputStream getOutputStream(IOutputTarget target, String entryPath) {
    if (!target.isEntryAvaialble(entryPath)) return null;

    return target.getEntryStream(entryPath);
  }