ZipEntry isDirectory - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for ZipEntry isDirectory method.

This code example shows how to use the following methods:getName, isDirectory
		return classes;
	} 
 
	private void addClassFromJar(JarEntry jarEntry, List<Class<?>> classes) {
		if (isMatchingClass(jarEntry)) {
			String fileName = jarEntry.getName();
			if (isValidClassName(fileName)) {
				Class<?> clazz = createClass(fileName);
				if (isNotNull(clazz)) {
					classes.add(clazz);
				} 
			} 
		} 
	} 
 
	private boolean isMatchingClass(JarEntry jarEntry) {
 
		boolean retVal = false;
		if (!jarEntry.isDirectory()) {
			String name = jarEntry.getName();

6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getName, getSize, isDirectory
     * @throws RepositoryException 
     * @throws IOException 
     */ 
    private boolean importZipEntry(ZipInputStream zin, ZipEntry entry, ImportContext context, Node node) throws RepositoryException, IOException {
        boolean success = false;
        log.debug("entry: " + entry.getName() + " size: " + entry.getSize());
        if (entry.isDirectory()) {
            IOUtil.mkDirs(node, makeValidJCRPath(entry.getName(), false), getCollectionNodeType());
            success = true;
        } else { 
            // import zip entry as file 
            BoundedInputStream bin = new BoundedInputStream(zin);
            bin.setPropagateClose(false);
            ImportContext entryContext = new ZipEntryImportContext(context, entry, bin, node);
 
            // let the iomanager deal with the individual entries. 
            IOManager ioManager = getIOManager();
            success = (ioManager != null) ? ioManager.importContent(entryContext, false) : false;
 
            // intermediate save in order to avoid problems with large zip files 
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getName, isDirectory
		assertTrue(ze.getName(),FileHelper.entryIsHidden(ze));
		 
		ze = new ZipEntry(".hidden_dir/");
		assertTrue(ze.getName(),FileHelper.entryIsHidden(ze));
 
		ze = new ZipEntry("SOME_MACOSX_BUNDLE/");
		assertTrue(ze.isDirectory());
		 
		assertTrue(ze.getName(),FileHelper.entryIsHidden(ze));
		 
		ze = new ZipEntry("Another_MacOSX_Bundle/");
		assertTrue(ze.getName(),FileHelper.entryIsHidden(ze));
		 
		ze = new ZipEntry("NOT_MACOSX_BUNDLE");
		assertFalse(ze.getName(),FileHelper.entryIsHidden(ze));
		 
		ze = new ZipEntry("unhidden_thing");
		assertFalse(ze.getName(),FileHelper.entryIsHidden(ze));
 
		ze = new ZipEntry("unhidden_dir/");
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getName, isDirectory
		this.target = target;
		return this;
	} 
 
	public void process(ZipEntry entry, ZipInputStream in) {
		String name = entry.getName();
		if (name == null) {
			throw new RuntimeException("name is required: " + entry);
		} 
 
		boolean isDirectory = entry.isDirectory();
 
		if (isDirectory) {
			unzipDirectory(name);
		} else { 
			unzipFile(name, in);
		} 
	} 
 
	protected File unzipFile(String name, ZipInputStream in) {
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getName, isDirectory
        delegate.close();
    } 
 
    private static void extract(ZipInputStream in, ZipEntry entry, File root)
            throws IOException { 
        if (!entry.isDirectory()) { // create the directtory
            File file = new File(root, entry.getName());
            if (!file.getParentFile().mkdirs()) { // make sure all parent
                                                  // directory exists 
                throw new IOException("Failed to create directory: "
                        + file.getParent());
            } 
            // write the file content 
            FileOutputStream out = new FileOutputStream(file);
            try { 
                FileUtils.copy(in, out);
            } finally { 
                out.close();
            } 
        } 
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getName, isDirectory
                timeToLive);
    } 
 
    @Override 
    public boolean isDirectory() { 
        if ("".equals(entry.getName()))
            return true; 
        return entry.isDirectory();
    } 
 
    @Override 
    public boolean isNormal() { 
        return !entry.isDirectory();
    } 
 
} 
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getCompressedSize, getMethod, getName, getSize, isDirectory
    * Dumps a zip entry into a string. 
    * @param ze a ZipEntry 
    */ 
   private String dumpZipEntry(ZipEntry ze) {
       StringBuffer sb=new StringBuffer();
       if (ze.isDirectory()) {
          sb.append("d "); //$NON-NLS-1$
       } else { 
          sb.append("f "); //$NON-NLS-1$
       } 
       if (ze.getMethod()==ZipEntry.STORED) {
          sb.append("stored   "); //$NON-NLS-1$
       } else { 
          sb.append("defalted "); //$NON-NLS-1$
       } 
       sb.append(ze.getName());
       sb.append("\t"); //$NON-NLS-1$
       sb.append(""+ze.getSize()); //$NON-NLS-1$
       if (ze.getMethod()==ZipEntry.DEFLATED) {
          sb.append("/"+ze.getCompressedSize()); //$NON-NLS-1$

6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getComment, getCrc, getExtra, getName, getSize
 
          Now, from some simple testing I did, it seems that the value of CRC-32 is 
          independent of the compression setting. So, it should be easy to pass this 
          information on to the output entry. 
        */ 
        String name = inputEntry.getName();
 
        if (!(inputEntry.isDirectory() || name.endsWith(".class"))) {
            try { 
                InputStream input = zip.getInputStream(zip.getEntry(name));
                String className = ClassNameReader.getClassName(input);
 
                input.close();
                if (className != null) {
                    name = className.replace('.', '/') + ".class";
                } 
            } catch (IOException ioe) {
                //do nothing 
            } 
        } 

6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getName, isDirectory
 
    /** 
     * Creates any required parent directories, returns the File to extract the entry to, returns null if there is no file to extract (such as a directory entry) 
     */ 
    protected static File checkDirectories(ZipEntry entry, File outputDir) {
        final String name = entry.getName();
         
        if (entry.isDirectory()) {
            createDir(new File(outputDir, name));
            return null; 
        } 
 
        final File outputFile = new File(outputDir, name);
        if (!outputFile.getParentFile().exists()) {
            createDir(outputFile.getParentFile());
        } 
         
        log.debug("Extracting " + name);
        return outputFile;
    } 
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getName, isDirectory
        assertEquals("my/resource.txt", zipEntry.getName());
        assertEquals("Hi!!", new String(StreamUtils.readStream(zipInputStream)));
 
        // my/folder 
        zipEntry = zipInputStream.getNextEntry();
        assertEquals("my/folder/", zipEntry.getName());
        assertTrue(zipEntry.isDirectory());
 
        // Archive.class 
        zipEntry = zipInputStream.getNextEntry();
        assertEquals("org/milyn/archive/Archive.class", zipEntry.getName());
    } 
 
    public void test_addEntries() throws IOException {
        Archive archive1 = new Archive("testarchive1");
 
        archive1.addEntry("//my/resource.txt", new ByteArrayInputStream("Hi!!".getBytes()));
        archive1.addEntry("my/folder");
        archive1.addEntry(Archive.class);
 
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java

Related ZipEntry isDirectory Questions & Answers:

isDirectory Method Overview
Returns true if this is a directory entry.
See Code Examples for other Java 8 ZipEntry Methods: