/** * Creates and returns an {@link AbstractFile} instance corresponding to the given entry node. * This method recurses to resolve the entry's parent file. * * @param entryNode tree node corresponding to the entry for which to return a file * @return an {@link AbstractFile} instance corresponding to the given entry node */ protected AbstractFile getArchiveEntryFile(DefaultMutableTreeNode entryNode) throws IOException { DefaultMutableTreeNode parentNode = (DefaultMutableTreeNode)entryNode.getParent(); return getArchiveEntryFile( (ArchiveEntry)entryNode.getUserObject(), parentNode==entryTreeRoot ?this :getArchiveEntryFile(parentNode) ); }
/** * Shorthand for {@link #getArchiveEntryFile(String)} called with the given entry's path. * * @param entry an entry contained by this archive * @return an AbstractFile that corresponds to the given entry * @throws IOException if neither the entry nor its parent exist within the archive * @throws UnsupportedFileOperationException if {@link FileOperation#READ_FILE} operations are not supported by the * underlying file protocol. */ public AbstractFile getArchiveEntryFile(ArchiveEntry entry) throws IOException, UnsupportedFileOperationException { return getArchiveEntryFile(entry.getPath()); }
parentFile = getArchiveEntryFile(parentPath); if(parentFile==null) // neither the entry nor the parent exist throw new IOException(); return getArchiveEntryFile(new ArchiveEntry(entryPath, false, 0, 0, false), parentFile); return getArchiveEntryFile(entryNode);
/** * Returns the contents (direct children) of the specified tree node. * * @throws UnsupportedFileOperationException if {@link FileOperation#READ_FILE} operations are not supported by the * underlying file protocol. */ private AbstractFile[] ls(DefaultMutableTreeNode treeNode, AbstractFile parentFile, FilenameFilter filenameFilter, FileFilter fileFilter) throws IOException, UnsupportedFileOperationException { AbstractFile files[]; int nbChildren = treeNode.getChildCount(); // No FilenameFilter, create entry files and store them directly into an array if(filenameFilter==null) { files = new AbstractFile[nbChildren]; for(int c=0; c<nbChildren; c++) { files[c] = getArchiveEntryFile((ArchiveEntry)(((DefaultMutableTreeNode)treeNode.getChildAt(c)).getUserObject()), parentFile); } } // Use provided FilenameFilter and temporarily store created entry files that match the filter in a Vector else { Vector<AbstractFile> filesV = new Vector<AbstractFile>(); for(int c=0; c<nbChildren; c++) { ArchiveEntry entry = (ArchiveEntry)(((DefaultMutableTreeNode)treeNode.getChildAt(c)).getUserObject()); if(!filenameFilter.accept(entry.getName())) continue; filesV.add(getArchiveEntryFile(entry, parentFile)); } files = new AbstractFile[filesV.size()]; filesV.toArray(files); } return fileFilter==null?files:fileFilter.filter(files); }
return ((AbstractArchiveFile)FileFactory.getFile(getJarFilePath(aClassURL))).getArchiveEntryFile(path);
AbstractFile tempEntryFile = ((AbstractArchiveFile)currentFile).getArchiveEntryFile(PathUtils.removeLeadingSeparator(currentPath.substring(currentFile.getURL().getPath().length(), currentPath.length()), pathSeparator)); if (tempEntryFile.isArchive()) { currentFile = tempEntryFile; currentFile = ((AbstractArchiveFile)currentFile).getArchiveEntryFile(PathUtils.removeLeadingSeparator(currentPath.substring(currentFile.getURL().getPath().length(), currentPath.length()), pathSeparator));
entryFile = archiveFile.getArchiveEntryFile(entryPath);