@Override public VirtualFile[] list() throws IOException { try { List<FilePath> kids = f.list(); VirtualFile[] vfs = new VirtualFile[kids.size()]; for (int i = 0; i < vfs.length; i++) { vfs[i] = new FilePathVF(kids.get(i), this.root); } return vfs; } catch (InterruptedException x) { throw new IOException(x); } } @Override public Collection<String> list(String includes, String excludes, boolean useDefaultExcludes) throws IOException {
/** * TODO un-restrict it in a weekly after the patch */ @Override @Restricted(NoExternalUse.class) public boolean isDescendant(String potentialChildRelativePath) throws IOException { if (new File(potentialChildRelativePath).isAbsolute()) { throw new IllegalArgumentException("Only a relative path is supported, the given path is absolute: " + potentialChildRelativePath); } String relativePath = computeRelativePathToRoot(); try { return this.root.isDescendant(relativePath + potentialChildRelativePath); } catch (InterruptedException e) { return false; } }
@Override public VirtualFile child(String name) { return forFilePath(f.child(name)); } @Override public long length() throws IOException {
@Override public VirtualFile[] list() throws IOException { try { List<FilePath> kids = f.list(); VirtualFile[] vfs = new VirtualFile[kids.size()]; for (int i = 0; i < vfs.length; i++) { vfs[i] = forFilePath(kids.get(i)); } return vfs; } catch (InterruptedException x) { throw (IOException) new IOException(x.toString()).initCause(x); } } @Override public String[] list(String glob) throws IOException {
/** * Creates a virtual file wrapper for a remotable file. * @param f a local or remote file (need not exist) * @return a wrapper */ public static VirtualFile forFilePath(final FilePath f) { return new FilePathVF(f); } private static final class FilePathVF extends VirtualFile {
@Override public boolean isFile() throws IOException { // TODO should probably introduce a method for this purpose return exists() && !isDirectory(); } @Override public boolean exists() throws IOException {
@Override public VirtualFile child(String name) { return new FilePathVF(f.child(name), this.root); } @Override public long length() throws IOException {
/** * Creates a virtual file wrapper for a remotable file. * @param f a local or remote file (need not exist) * @return a wrapper */ public static VirtualFile forFilePath(final FilePath f) { return new FilePathVF(f, f); } private static final class FilePathVF extends VirtualFile {
@Override public boolean isFile() throws IOException { // TODO should probably introduce a method for this purpose return exists() && !isDirectory(); } @Override public boolean exists() throws IOException {