/** * Sets Unix permissions in a way that is understood by Info-Zip's * unzip command. * @param mode an <code>int</code> value */ public void setUnixMode(final int mode) { // CheckStyle:MagicNumberCheck OFF - no point setExternalAttributes((mode << SHORT_SHIFT) // MS-DOS read-only attribute | ((mode & 0200) == 0 ? 1 : 0) // MS-DOS directory flag | (isDirectory() ? 0x10 : 0)); // CheckStyle:MagicNumberCheck ON platform = PLATFORM_UNIX; }
while (entries.hasMoreElements()) { final ZipArchiveEntry entry = entries.nextElement(); if (!entry.isDirectory()) { final String name = entry.getName().toLowerCase(); if (name.endsWith(".class")) {
@Test public void test1() throws IOException { ZipArchiveInputStream zis = new ZipArchiveInputStream(BadZipEntryFlagTest.class.getResourceAsStream("/bad.zip")); for (ZipArchiveEntry e = zis.getNextZipEntry(); e != null; e = zis.getNextZipEntry()) { e.getGeneralPurposeBit().useEncryption(false); if (!e.isDirectory()) { zis.read(); System.out.println(e.getName()); } } }
@Override public boolean isDirectory() { return zipEntry.isDirectory(); }
public ZipResource( ZipFile zipFile, ZipArchiveEntry entry, InputStreamTransformer streamTransformer ) { super( entry.getName(), getLastModofied( entry ), entry.isDirectory() ? PlexusIoResource.UNKNOWN_RESOURCE_SIZE : entry.getSize(), !entry.isDirectory(), entry.isDirectory(), true ); this.zipFile = zipFile; this.entry = entry; this.streamTransformer = streamTransformer; }
@Override public boolean isFile() { return !zipEntry.isDirectory() && !zipEntry.isUnixSymlink(); }
private ZipFileResource( JarFile jarFile, ZipArchiveEntry entry ) { super( entry.getName(), entry.getTime() == -1 ? PlexusIoResource.UNKNOWN_MODIFICATION_DATE : entry.getTime(), entry.isDirectory() ? PlexusIoResource.UNKNOWN_RESOURCE_SIZE : entry.getSize(), !entry.isDirectory(), entry.isDirectory(), true ); this.jarFile = jarFile; }
private static MediaType detectKmz(ZipFile zip) { boolean kmlFound = false; Enumeration<ZipArchiveEntry> entries = zip.getEntries(); while (entries.hasMoreElements()) { ZipArchiveEntry entry = entries.nextElement(); String name = entry.getName(); if (!entry.isDirectory() && name.indexOf('/') == -1 && name.indexOf('\\') == -1) { if (name.endsWith(".kml") && !kmlFound) { kmlFound = true; } else { return null; } } } if (kmlFound) { return MediaType.application("vnd.google-earth.kmz"); } else { return null; } }
INDEX_NAME ) && !name.equals( MANIFEST_NAME ) ) if ( ze.isDirectory() )
ZipArchiveEntry zae = zipArchiveInputStream.getNextZipEntry(); while (zae != null) { if (zae.isDirectory()) { zae = zipArchiveInputStream.getNextZipEntry(); continue;
if ( zipArchiveEntry.isDirectory() && !zipArchiveEntry.isUnixSymlink() ) if ( zipArchiveEntry.isDirectory() ) if ( zipArchiveEntry.isDirectory() )
boolean matches(final ZipArchiveEntry zipEntry) { return zipEntry.isDirectory(); } },
boolean matches(final ZipArchiveEntry zipEntry) { return !zipEntry.isDirectory(); } },
@Override public boolean isDirectory() { return zipEntry.isDirectory(); }
ze.getName(), new Date( ze.getTime() ), ze.isDirectory(), ze.getUnixMode() != 0 ? ze.getUnixMode() : null, resolveSymlink( zipFile, ze ), getFileMappers() );
while (zae != null) { try { if (!zae.isDirectory() && zipArchiveInputStream.canReadEntryData(zae)) { outputStream.putArchiveEntry(zae);
new Date( ze.getTime() ), ze.isDirectory(), ze.getUnixMode() != 0 ? ze.getUnixMode() : null, resolveSymlink( zf, ze ), getFileMappers() );
@Override protected String getRelativePath(ZipFileResource container, ZipArchiveEntry entry) { String name = entry.getName(); if (entry.isDirectory()) { // strip trailing slash from directory entries return "/" + name.substring(0, name.length() - 1); } else { return "/" + name; } }
@Override protected Resource getEntry(final ZipFileResource container, final ZipArchiveEntry entry) { if (entry.isDirectory()) { return new AbstractDirectoryResource(entry.getName()) { }; } else { return new ZipArchiveEntryResource(container, entry); } }
public void addEntry(ZipArchiveEntry zipArchiveEntry, InputStreamSupplier streamSupplier) throws IOException { if (zipArchiveEntry.isDirectory() && !zipArchiveEntry.isUnixSymlink()) dirs.addArchiveEntry(ZipArchiveEntryRequest.createZipArchiveEntryRequest(zipArchiveEntry, streamSupplier)); else scatterZipCreator.addArchiveEntry(zipArchiveEntry, streamSupplier); }