protected JarEntry createEntry(JarEntry rootEntry, JarEntry template) { if(rootEntry == null) return new JarEntry(template); String name = template.getName().substring(rootEntry.getName().length()); JarEntry entry = new JarEntry(name); entry.setComment(template.getComment()); entry.setSize(template.getSize()); entry.setTime(template.getTime()); return entry; }
newEntry.setMethod(oldEntry.getMethod()); newEntry.setExtra(oldEntry.getExtra()); newEntry.setComment(oldEntry.getComment());
newEntry.setMethod( oldEntry.getMethod() ); newEntry.setExtra( oldEntry.getExtra() ); newEntry.setComment( oldEntry.getComment() );
/** * Write a nested library. * * @param destination the destination of the library * @param library the library * @throws IOException if the write fails */ public void writeNestedLibrary(String destination, Library library) throws IOException { File file = library.getFile(); JarEntry entry = new JarEntry(destination + library.getName()); entry.setTime(getNestedLibraryTime(file)); if (library.isUnpackRequired()) { entry.setComment("UNPACK:" + FileUtils.sha1Hash(file)); } new CrcAndSize(file).setupStoredEntry(entry); writeEntry(entry, new InputStreamEntryWriter(new FileInputStream(file), true)); }
/** * Write a nested library. * * @param destination the destination of the library * @param library the library * @throws IOException if the write fails */ public void writeNestedLibrary(String destination, Library library) throws IOException { File file = library.getFile(); JarEntry entry = new JarEntry(destination + library.getName()); entry.setTime(getNestedLibraryTime(file)); if (library.isUnpackRequired()) { entry.setComment("UNPACK:" + FileUtils.sha1Hash(file)); } new CrcAndSize(file).setupStoredEntry(entry); writeEntry(entry, new InputStreamEntryWriter(new FileInputStream(file), true)); }
private static JarEntry smartClone(JarEntry originalJarEntry) { final JarEntry newJarEntry = new JarEntry(originalJarEntry.getName()); newJarEntry.setComment(originalJarEntry.getComment()); newJarEntry.setExtra(originalJarEntry.getExtra()); newJarEntry.setMethod(originalJarEntry.getMethod()); newJarEntry.setTime(originalJarEntry.getTime()); //Must set size and CRC for STORED entries if (newJarEntry.getMethod() == ZipEntry.STORED) { newJarEntry.setSize(originalJarEntry.getSize()); newJarEntry.setCrc(originalJarEntry.getCrc()); } return newJarEntry; }
@Override public JarEntry transform(JarEntry entry) { JarEntry renamedEntry = new JarEntry(this.namePrefix + entry.getName()); renamedEntry.setTime(entry.getTime()); renamedEntry.setSize(entry.getSize()); renamedEntry.setMethod(entry.getMethod()); if (entry.getComment() != null) { renamedEntry.setComment(entry.getComment()); } renamedEntry.setCompressedSize(entry.getCompressedSize()); renamedEntry.setCrc(entry.getCrc()); //setCreationTimeIfPossible(entry, renamedEntry); if (entry.getExtra() != null) { renamedEntry.setExtra(entry.getExtra()); } return renamedEntry; }
@Override public JarEntry transform(JarEntry entry) { JarEntry renamedEntry = new JarEntry(this.namePrefix + entry.getName()); renamedEntry.setTime(entry.getTime()); renamedEntry.setSize(entry.getSize()); renamedEntry.setMethod(entry.getMethod()); if (entry.getComment() != null) { renamedEntry.setComment(entry.getComment()); } renamedEntry.setCompressedSize(entry.getCompressedSize()); renamedEntry.setCrc(entry.getCrc()); //setCreationTimeIfPossible(entry, renamedEntry); if (entry.getExtra() != null) { renamedEntry.setExtra(entry.getExtra()); } return renamedEntry; }