public long getCRC() { return entry.getCrc(); } }
public long getCrc() { return super.getCrc(); }
public boolean contains (JarFile2 f, JarEntry e) throws IOException { JarEntry thisEntry = getEntryByName(e.getName()); // Look up name in 'this' Jar2File - if not exist return false if (thisEntry == null) return false; // Check CRC - if no match - return false if (thisEntry.getCrc() != e.getCrc()) return false; // Check contents - if no match - return false try (InputStream oldIS = getJarFile().getInputStream(thisEntry); InputStream newIS = f.getJarFile().getInputStream(e)) { return !differs(oldIS, newIS); } }
while (entries.hasMoreElements()) { JarEntry entry = entries.nextElement(); long crc = entry.getCrc(); Long crcL = Long.valueOf(crc); if (_debug) {
public String hasSameContent (JarFile2 file, JarEntry entry) throws IOException { String thisName = null; Long crcL = Long.valueOf(entry.getCrc()); // check if this jar contains files with the passed in entry's crc if (_crcToEntryMap.containsKey(crcL)) { // get the Linked List with files with the crc LinkedList<JarEntry> ll = _crcToEntryMap.get(crcL); // go through the list and check for content match ListIterator<JarEntry> li = ll.listIterator(0); while (li.hasNext()) { JarEntry thisEntry = li.next(); // check for content match try (InputStream oldIS = getJarFile().getInputStream(thisEntry); InputStream newIS = file.getJarFile().getInputStream(entry)) { if (!differs(oldIS, newIS)) { thisName = thisEntry.getName(); return thisName; } } } } return thisName; }
long crc = entry.getCrc();
public boolean contains( JarFile2 f, JarEntry e ) throws IOException { JarEntry thisEntry = getEntryByName( e.getName() ); // Look up name in 'this' Jar2File - if not exist return false if ( thisEntry == null ) { return false; } // Check CRC - if no match - return false if ( thisEntry.getCrc() != e.getCrc() ) { return false; } // Check contents - if no match - return false InputStream oldIS = getJarFile().getInputStream( thisEntry ); InputStream newIS = f.getJarFile().getInputStream( e ); boolean retValue = differs( oldIS, newIS ); return !retValue; }
public String hasSameContent( JarFile2 file, JarEntry entry ) throws IOException { String thisName = null; Long crcL = new Long( entry.getCrc() ); // check if this jar contains files with the passed in entry's crc if ( _crcToEntryMap.containsKey( crcL ) ) { // get the Linked List with files with the crc LinkedList ll = (LinkedList) _crcToEntryMap.get( crcL ); // go through the list and check for content match ListIterator li = ll.listIterator( 0 ); if ( li != null ) { while ( li.hasNext() ) { JarEntry thisEntry = (JarEntry) li.next(); // check for content match InputStream oldIS = getJarFile().getInputStream( thisEntry ); InputStream newIS = file.getJarFile().getInputStream( entry ); if ( !differs( oldIS, newIS ) ) { thisName = thisEntry.getName(); return thisName; } } } } return thisName; }
newJarEntry.setMethod(jarEntry.getMethod()); newJarEntry.setCompressedSize(jarEntry.getCompressedSize()); newJarEntry.setCrc(jarEntry.getCrc()); jos.putNextEntry(newJarEntry);
if (aJarEntry.getSize () == 0 && aJarEntry.getCrc () == 0)
newEntry.setSize(oldEntry.getSize()); newEntry.setCompressedSize(oldEntry.getCompressedSize()); newEntry.setCrc(oldEntry.getCrc()); newEntry.setMethod(oldEntry.getMethod()); newEntry.setExtra(oldEntry.getExtra());
newEntry.setSize( oldEntry.getSize() ); newEntry.setCompressedSize( oldEntry.getCompressedSize() ); newEntry.setCrc( oldEntry.getCrc() ); newEntry.setMethod( oldEntry.getMethod() ); newEntry.setExtra( oldEntry.getExtra() );
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; }
/** * Get the ZipEntry for the given JarEntry. Added in order to suppress the * compressedSize field as it was causing errors * * @param je The jar entry. * @return ZipEntry with fields populated from the JarEntry. */ private static ZipEntry getZipEntry(JarEntry je) { ZipEntry ze = new ZipEntry(je.getName()); ze.setComment(je.getComment()); ze.setCrc(je.getCrc()); ze.setExtra(je.getExtra()); ze.setMethod(je.getMethod()); ze.setSize(je.getSize()); ze.setTime(je.getTime()); return ze; } }
/** * Get the ZipEntry for the given JarEntry. Added in order to suppress the * compressedSize field as it was causing errors * * @param je The jar entry. * @return ZipEntry with fields populated from the JarEntry. */ private static ZipEntry getZipEntry(JarEntry je) { ZipEntry ze = new ZipEntry(je.getName()); ze.setComment(je.getComment()); ze.setCrc(je.getCrc()); ze.setExtra(je.getExtra()); ze.setMethod(je.getMethod()); ze.setSize(je.getSize()); ze.setTime(je.getTime()); return ze; } }
@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; }