public class DefaultProjectFilesystemView extends Object implements ProjectFilesystemView
| Modifier and Type | Method and Description |
|---|---|
com.google.common.collect.ImmutableCollection<Path> |
getDirectoryContents(Path pathToUse)
Gets a list of paths of the contents of the given directory, obeying the ignores.
|
com.google.common.collect.ImmutableSet<Path> |
getFilesUnderPath(Path pathRelativeToProjectRoot,
EnumSet<FileVisitOption> visitOptions) |
com.google.common.collect.ImmutableSet<Path> |
getFilesUnderPath(Path pathRelativeToProjectRoot,
com.google.common.base.Predicate<Path> filter,
EnumSet<FileVisitOption> visitOptions)
Returns a list of files under the given path relative to the root of this view, filtered both
blacklist and the given filter.
|
Path |
getRootPath() |
boolean |
isDirectory(Path path) |
boolean |
isFile(Path path,
LinkOption... options)
Checks whether there is a normal file at the specified path
|
boolean |
isIgnored(Path path) |
boolean |
isSubdirOf(Path path) |
<A extends BasicFileAttributes> |
readAttributes(Path path,
Class<A> type,
LinkOption... options)
Read basic attributes of a file from a file system
|
Path |
relativize(Path path) |
Path |
resolve(ForwardRelativePath path) |
Path |
resolve(Path path) |
Path |
resolve(String path) |
com.google.common.collect.ImmutableList<String> |
toWatchmanQuery(Set<Capability> capabilities) |
void |
walkFileTree(Path pathRelativeToProjectRoot,
Set<FileVisitOption> options,
FileVisitor<Path> fileVisitor)
Walks the filesystem starting at a given path relative to the root of this view, and all paths
give to
fileVisitor is absolute |
void |
walkRelativeFileTree(Path pathRelativeToProjectRoot,
EnumSet<FileVisitOption> visitOptions,
FileVisitor<Path> fileVisitor)
Similar to
ProjectFilesystemView.walkFileTree(Path, Set, FileVisitor) fileVisitor receives paths relative to
the root of this view |
DefaultProjectFilesystemView |
withView(Path newRelativeRoot,
com.google.common.collect.ImmutableSet<PathMatcher> additionalIgnores) |
void |
writeLinesToPath(Iterable<String> lines,
Path path,
FileAttribute<?>... attrs) |
public com.google.common.collect.ImmutableList<String> toWatchmanQuery(Set<Capability> capabilities)
toWatchmanQuery in interface ProjectFilesystemViewpublic boolean isSubdirOf(Path path)
isSubdirOf in interface ProjectFilesystemViewpath - an absolute pathpublic Path relativize(Path path)
relativize in interface ProjectFilesystemViewpath - an absolute path to relativizepublic Path resolve(Path path)
resolve in interface ProjectFilesystemViewpath - the relative path to resolvepublic Path resolve(String path)
resolve in interface ProjectFilesystemViewProjectFilesystemView.resolve(Path)public Path resolve(ForwardRelativePath path)
resolve in interface ProjectFilesystemViewProjectFilesystemView.resolve(Path)public boolean isFile(Path path, LinkOption... options)
ProjectFilesystemViewisFile in interface ProjectFilesystemViewpath - relative path to the rootoptions - whether to resolve symlinkspublic boolean isDirectory(Path path)
isDirectory in interface ProjectFilesystemViewpath - relative path to the rootpublic <A extends BasicFileAttributes> A readAttributes(Path path, Class<A> type, LinkOption... options) throws IOException
ProjectFilesystemViewreadAttributes in interface ProjectFilesystemViewpath - relative path to the roottype - type of attributes objectoptions - whether to resolve symlinksIOExceptionpublic Path getRootPath()
getRootPath in interface ProjectFilesystemViewpublic DefaultProjectFilesystemView withView(Path newRelativeRoot, com.google.common.collect.ImmutableSet<PathMatcher> additionalIgnores)
withView in interface ProjectFilesystemViewnewRelativeRoot - the new root relative to the current rootadditionalIgnores - new ignored paths in addition to the current ignorespublic boolean isIgnored(Path path)
isIgnored in interface ProjectFilesystemViewpath - an relative paths to the root of this filesystem viewpublic void walkRelativeFileTree(Path pathRelativeToProjectRoot, EnumSet<FileVisitOption> visitOptions, FileVisitor<Path> fileVisitor) throws IOException
ProjectFilesystemViewProjectFilesystemView.walkFileTree(Path, Set, FileVisitor) fileVisitor receives paths relative to
the root of this viewwalkRelativeFileTree in interface ProjectFilesystemViewIOExceptionpublic void walkFileTree(Path pathRelativeToProjectRoot, Set<FileVisitOption> options, FileVisitor<Path> fileVisitor) throws IOException
ProjectFilesystemViewfileVisitor is absolutewalkFileTree in interface ProjectFilesystemViewIOExceptionpublic com.google.common.collect.ImmutableSet<Path> getFilesUnderPath(Path pathRelativeToProjectRoot, EnumSet<FileVisitOption> visitOptions) throws IOException
getFilesUnderPath in interface ProjectFilesystemViewIOExceptionpublic com.google.common.collect.ImmutableSet<Path> getFilesUnderPath(Path pathRelativeToProjectRoot, com.google.common.base.Predicate<Path> filter, EnumSet<FileVisitOption> visitOptions) throws IOException
ProjectFilesystemViewgetFilesUnderPath in interface ProjectFilesystemViewIOExceptionpublic com.google.common.collect.ImmutableCollection<Path> getDirectoryContents(Path pathToUse) throws IOException
ProjectFilesystemViewgetDirectoryContents in interface ProjectFilesystemViewIOExceptionpublic void writeLinesToPath(Iterable<String> lines, Path path, FileAttribute<?>... attrs) throws IOException
writeLinesToPath in interface ProjectFilesystemViewlines - the lines to write to the file. Each item is written as one linepath - the path relative to the view of this root to write the file. The parent of the
path must existattrs - the FileAttributes for the file createdIOException