private InputStream getInputStream(IInputSource source, String entryPath) throws CoreException { if (!source.hasEntry(entryPath)) return null; InputStream in = source.getEntryStream(entryPath); if (in == null) return null; if (manifest != null) { IEncryptionData encData = manifest.getEncryptionData(entryPath); if (encData != null) { in = createDecryptedStream(in, encData); } } return in; }
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); } }
private void copyOtherStaff() throws IOException, CoreException { if (ignoreCopy || source == null || storage == null) return; if (!source.equals(storage.getInputSource())) { IOutputTarget target = storage.getOutputTarget(); copyAll(source, target); } else { // Prefetch all file entries: workbook.getManifest().getFileEntries(); } }