public class FsFile
extends java.lang.Object
File
representing an FS repository file-path.
The file-path is relative to the root of the repository. As with
File
, instances of this class are immutable.Modifier and Type | Field and Description |
---|---|
static FsFile |
emptyPath
the FsFile that has no path components
|
static char |
separatorChar
the separator character for delimiting repository path components
|
Constructor and Description |
---|
FsFile(java.util.Collection<java.lang.String> components)
Construct an instance.
|
FsFile(java.io.File file)
Construct an instance.
|
FsFile(FsFile file,
int maxComponentCount)
Construct an instance by trimming parent directories from an existing instance
such that the depth does not exceed the given maximum.
|
FsFile(java.lang.String... components)
Construct an instance.
|
FsFile(java.lang.String path)
Construct an instance.
|
Modifier and Type | Method and Description |
---|---|
static FsFile |
concatenate(FsFile... files)
Concatenate paths.
|
boolean |
equals(java.lang.Object object)
Instances are equal if their string representations match.
|
java.util.List<java.lang.String> |
getComponents()
Get the path components of this instance.
|
FsFile |
getPathFrom(FsFile file)
Find the relative path of this path from a given parent.
|
int |
hashCode() |
java.io.File |
toFile(java.io.File file)
Convert this instance to a
File
relative to the given File . |
java.lang.String |
toString()
Provides repository path with components separated by
separatorChar . |
FsFile |
transform(com.google.common.base.Function<java.lang.String,java.lang.String> componentTransformer)
Transform each path component with the given transformer.
|
public static char separatorChar
public static FsFile emptyPath
public FsFile(java.util.Collection<java.lang.String> components)
components
- the components of the path to which this instance corresponds, may be nullpublic FsFile(java.lang.String... components)
components
- the components of the path to which this instance correspondspublic FsFile(FsFile file, int maxComponentCount)
file
- an existing instancemaxComponentCount
- the number of child components of the instance,
including filename, above which parents should be ignoredpublic FsFile(java.io.File file)
file
- the file to whose absolute path this instance correspondspublic FsFile(java.lang.String path)
path
- the path that this instance's string representation must matchpublic FsFile transform(com.google.common.base.Function<java.lang.String,java.lang.String> componentTransformer)
componentTransformer
- a transformerpublic FsFile getPathFrom(FsFile file)
file
- a parent path (may be the same as this one)public static FsFile concatenate(FsFile... files)
files
- the paths to concatenatepublic java.util.List<java.lang.String> getComponents()
public java.io.File toFile(java.io.File file)
File
relative to the given File
.file
- parent directory, may be null for a relative return value,
but actually expected to be the repository's root directorypublic java.lang.String toString()
separatorChar
.
Suitable for displaying to the user and for constructing a new instance.toString
in class java.lang.Object
public boolean equals(java.lang.Object object)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
Version: 5.4.10-ice35-b105
Copyright © 2019 The University of Dundee & Open Microscopy Environment. All Rights Reserved.