public final class IgfsPath extends Object implements Comparable<IgfsPath>, Externalizable
IGFS
path to file in the file system. For example, to get information about
a file you would use the following code:
IgfsPath dirPath = new IgfsPath("/my/working/dir"); IgfsPath filePath = new IgfsPath(dirPath, "file.txt"); // Get metadata about file. IgfsFile file = igfs.info(filePath);
Modifier and Type | Field and Description |
---|---|
static String |
SLASH
The directory separator.
|
Constructor and Description |
---|
IgfsPath()
Constructs default root path.
|
IgfsPath(IgfsPath parentPath,
String childPath)
Resolve a child path against a parent path.
|
IgfsPath(String path)
Constructs a path from the URI string.
|
IgfsPath(URI uri)
Constructs a path from an URI
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(IgfsPath o) |
List<String> |
components()
Split full path on components.
|
int |
depth()
Return the number of elements in this path.
|
boolean |
equals(Object o) |
int |
hashCode() |
boolean |
isSame(IgfsPath path)
Checks if paths are identical.
|
boolean |
isSubDirectoryOf(IgfsPath path)
Checks whether this path is a sub-directory of argument.
|
String |
name()
Returns the final component of this path.
|
IgfsPath |
parent()
Returns the parent of a path or
null if at root. |
void |
readExternal(ObjectInput in) |
IgfsPath |
root()
Returns a root for this path.
|
IgfsPath |
suffix(String suffix)
Adds a suffix to the final name in the path.
|
String |
toString() |
void |
writeExternal(ObjectOutput out) |
public static final String SLASH
public IgfsPath()
public IgfsPath(URI uri)
uri
- URI to create path from.public IgfsPath(String path)
path
- URI string.public String name()
public IgfsPath root()
@Nullable public IgfsPath parent()
null
if at root.null
if at root.public IgfsPath suffix(String suffix)
suffix
- Suffix.public int depth()
public boolean isSubDirectoryOf(IgfsPath path)
path
- Path to check.True
if argument is same or a sub-directory of this object.public boolean isSame(IgfsPath path)
path
- Path to check.True
if paths are identical.public int compareTo(IgfsPath o)
compareTo
in interface Comparable<IgfsPath>
public void writeExternal(ObjectOutput out) throws IOException
writeExternal
in interface Externalizable
IOException
public void readExternal(ObjectInput in) throws IOException
readExternal
in interface Externalizable
IOException
Follow @ApacheIgnite
Ignite Fabric : ver. 1.5.0.final Release Date : December 29 2015