public interface ProjectFilesystemView
ProjectFilesystem
. All traversal operations on this filesystem
behaves according configured ignored paths and according to the configured rootpath.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
walkFileTree(Path, Set, FileVisitor) fileVisitor receives paths relative to
the root of this view |
ProjectFilesystemView |
withView(Path newRelativeRoot,
com.google.common.collect.ImmutableSet<PathMatcher> additionalIgnores) |
void |
writeLinesToPath(Iterable<String> lines,
Path path,
FileAttribute<?>... attrs) |
boolean isSubdirOf(Path path)
path
- an absolute pathPath relativize(Path path)
path
- an absolute path to relativizePath resolve(Path path)
path
- the relative path to resolvePath resolve(String path)
resolve(Path)
Path resolve(ForwardRelativePath path)
resolve(Path)
boolean isFile(Path path, LinkOption... options)
path
- relative path to the rootoptions
- whether to resolve symlinksboolean isDirectory(Path path)
path
- relative path to the root<A extends BasicFileAttributes> A readAttributes(Path path, Class<A> type, LinkOption... options) throws IOException
path
- relative path to the roottype
- type of attributes objectoptions
- whether to resolve symlinksIOException
Path getRootPath()
ProjectFilesystemView withView(Path newRelativeRoot, com.google.common.collect.ImmutableSet<PathMatcher> additionalIgnores)
newRelativeRoot
- the new root relative to the current rootadditionalIgnores
- new ignored paths in addition to the current ignoresboolean isIgnored(Path path)
path
- an relative paths to the root of this filesystem viewvoid walkRelativeFileTree(Path pathRelativeToProjectRoot, EnumSet<FileVisitOption> visitOptions, FileVisitor<Path> fileVisitor) throws IOException
walkFileTree(Path, Set, FileVisitor)
fileVisitor receives paths relative to
the root of this viewIOException
void walkFileTree(Path pathRelativeToProjectRoot, Set<FileVisitOption> options, FileVisitor<Path> fileVisitor) throws IOException
fileVisitor
is absoluteIOException
com.google.common.collect.ImmutableSet<Path> getFilesUnderPath(Path pathRelativeToProjectRoot, EnumSet<FileVisitOption> visitOptions) throws IOException
IOException
com.google.common.collect.ImmutableSet<Path> getFilesUnderPath(Path pathRelativeToProjectRoot, com.google.common.base.Predicate<Path> filter, EnumSet<FileVisitOption> visitOptions) throws IOException
IOException
com.google.common.collect.ImmutableCollection<Path> getDirectoryContents(Path pathToUse) throws IOException
IOException
void writeLinesToPath(Iterable<String> lines, Path path, FileAttribute<?>... attrs) throws IOException
lines
- 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 FileAttribute
s for the file createdIOException
com.google.common.collect.ImmutableList<String> toWatchmanQuery(Set<Capability> capabilities)