List of usage examples for org.apache.commons.vfs.provider UriParser encode
public static String[] encode(String[] strings)
From source file:net.didion.loopy.vfs.provider.iso.IsoFileSystem.java
public void init() throws FileSystemException { super.init(); final File file = getParentLayer().getFileSystem().replicateFile(getParentLayer(), Selectors.SELECT_SELF); try {/* ww w. ja v a 2 s.c o m*/ this.fileSystem = new ISO9660FileSystem(file, true); } catch (IOException ex) { throw new FileSystemException("vfs.provider.iso/open-iso-file.error", file, ex); } // Build the index final List strongRef = new ArrayList(100); final Enumeration entries = this.fileSystem.getEntries(); while (entries.hasMoreElements()) { final ISO9660FileEntry entry = (ISO9660FileEntry) entries.nextElement(); String name = entry.getPath(); // skip entries without names (should only be one - the root entry) if ("".equals(name)) { continue; } final FileName filename = getFileSystemManager().resolveName(getRootName(), UriParser.encode(name)); // Create the file IsoFileObject fileObj; if (entry.isDirectory() && getFileFromCache(filename) != null) { fileObj = (IsoFileObject) getFileFromCache(filename); fileObj.setIsoEntry(entry); continue; } fileObj = new IsoFileObject(filename, entry, this); putFileToCache(fileObj); strongRef.add(fileObj); fileObj.holdObject(strongRef); // Make sure all ancestors exist IsoFileObject parent; for (FileName parentName = filename .getParent(); parentName != null; fileObj = parent, parentName = parentName.getParent()) { // Locate the parent parent = (IsoFileObject) getFileFromCache(parentName); if (parent == null) { parent = new IsoFileObject(parentName, this); putFileToCache(parent); strongRef.add(parent); parent.holdObject(strongRef); } // Attach child to parent parent.attachChild(fileObj.getName()); } } }
From source file:com.github.stephenc.javaisotools.vfs.provider.iso.IsoFileSystem.java
public void init() throws FileSystemException { super.init(); final File file = getParentLayer().getFileSystem().replicateFile(getParentLayer(), Selectors.SELECT_SELF); try {/*from w w w . j a va2s . c o m*/ this.fileSystem = new Iso9660FileSystem(file, true); } catch (IOException ex) { throw new FileSystemException("vfs.provider.iso/open-iso-file.error", file, ex); } // Build the index final List strongRef = new ArrayList(100); boolean skipRoot = false; for (Iso9660FileEntry entry : this.fileSystem) { String name = entry.getPath(); // skip entries without names (should only be one - the root entry) if ("".equals(name)) { if (!skipRoot) { skipRoot = true; } else { continue; } } final FileName filename = getFileSystemManager().resolveName(getRootName(), UriParser.encode(name)); // Create the file IsoFileObject fileObj; if (entry.isDirectory() && getFileFromCache(filename) != null) { fileObj = (IsoFileObject) getFileFromCache(filename); fileObj.setIsoEntry(entry); continue; } fileObj = new IsoFileObject(filename, entry, this); putFileToCache(fileObj); strongRef.add(fileObj); fileObj.holdObject(strongRef); // Make sure all ancestors exist IsoFileObject parent; for (FileName parentName = filename .getParent(); parentName != null; fileObj = parent, parentName = parentName.getParent()) { // Locate the parent parent = (IsoFileObject) getFileFromCache(parentName); if (parent == null) { parent = new IsoFileObject(parentName, this); putFileToCache(parent); strongRef.add(parent); parent.holdObject(strongRef); } // Attach child to parent parent.attachChild(fileObj.getName()); } } }
From source file:org.objectweb.proactive.extensions.vfsprovider.client.ProActiveFileObject.java
@Override protected String[] doListChildren() throws Exception { final Set<String> files = getServer().fileListChildren(getPath()); if (files == null) { return null; }//from w w w . j av a 2 s . c o m final String result[] = new String[files.size()]; int i = 0; for (final String f : files) { result[i++] = UriParser.encode(f); } return result; }
From source file:org.sonatype.gshell.vfs.provider.truezip.TruezipFileObject.java
/** * Returns the children of the file. */ protected String[] doListChildren() throws Exception { return UriParser.encode(file.list()); }