public class Path extends Object implements Cloneable
Path interface.
Paths are always maintained in canonicalized form. That is, parent
references (i.e., ../../) and duplicate separators are
resolved. For example,
new Path("/a/b").append("../foo/bar")
will yield the path
/a/foo/bar
This class can be used without OSGi running.
This class is not intended to be subclassed by clients but may be instantiated.
Path| Modifier and Type | Field and Description |
|---|---|
static char |
DEVICE_SEPARATOR
Device separator character constant ":" used in paths.
|
static Path |
EMPTY
Constant value containing the empty path with no device.
|
static Path |
ROOT
Constant value containing the root path with no device.
|
static char |
SEPARATOR
Path separator character constant "/" used in paths.
|
| Constructor and Description |
|---|
Path(String fullPath)
Constructs a new path from the given string path.
|
Path(String device,
String path)
Constructs a new path from the given device id and string path.
|
| Modifier and Type | Method and Description |
|---|---|
Path |
addFileExtension(String extension)
addFileExtension.
|
Path |
addTrailingSeparator()
addTrailingSeparator.
|
Path |
append(Path tail)
append.
|
Path |
append(String tail)
append.
|
Object |
clone()
clone.
|
boolean |
equals(Object obj) |
static Path |
fromOSString(String pathString)
Constructs a new path from the given string path.
|
static Path |
fromPortableString(String pathString)
Constructs a new path from the given path string.
|
String |
getDevice()
Getter for the field
device. |
String |
getFileExtension()
getFileExtension.
|
int |
hashCode()
hashCode.
|
boolean |
hasTrailingSeparator()
hasTrailingSeparator.
|
boolean |
isAbsolute()
isAbsolute.
|
boolean |
isEmpty()
isEmpty.
|
boolean |
isPrefixOf(Path anotherPath)
isPrefixOf.
|
boolean |
isRoot()
isRoot.
|
boolean |
isUNC()
isUNC.
|
boolean |
isValidPath(String path)
isValidPath.
|
boolean |
isValidSegment(String segment)
isValidSegment.
|
String |
lastSegment()
lastSegment.
|
Path |
makeAbsolute()
makeAbsolute.
|
Path |
makeRelative()
makeRelative.
|
Path |
makeRelativeTo(Path base) |
Path |
makeUNC(boolean toUNC)
makeUNC.
|
int |
matchingFirstSegments(Path anotherPath)
matchingFirstSegments.
|
Path |
removeFileExtension()
removeFileExtension.
|
Path |
removeFirstSegments(int count)
removeFirstSegments.
|
Path |
removeLastSegments(int count)
removeLastSegments.
|
Path |
removeTrailingSeparator()
removeTrailingSeparator.
|
String |
segment(int index)
segment.
|
int |
segmentCount()
segmentCount.
|
String[] |
segments()
segments.
|
Path |
setDevice(String value)
Setter for the field
device. |
File |
toFile()
toFile.
|
String |
toOSString()
toOSString.
|
String |
toPortableString()
toPortableString.
|
String |
toString()
toString.
|
Path |
uptoSegment(int count)
uptoSegment.
|
public static final char SEPARATOR
public static final char DEVICE_SEPARATOR
public static final Path EMPTY
public static final Path ROOT
public Path(String fullPath)
fullPath - the string pathisValidPath(String)public Path(String device, String path)
device - the device idpath - the string pathisValidPath(String),
setDevice(String),
isValidPath(String),
setDevice(String)public static Path fromOSString(String pathString)
pathString - the portable string pathPath object.toPortableString()public static Path fromPortableString(String pathString)
Path.toPortableString.pathString - the portable path stringPath object.toPortableString()public Path addTrailingSeparator()
addTrailingSeparator.
Path object.public boolean hasTrailingSeparator()
hasTrailingSeparator.
public boolean isAbsolute()
isAbsolute.
public boolean isEmpty()
isEmpty.
public boolean isPrefixOf(Path anotherPath)
isPrefixOf.
anotherPath - a Path object.public boolean isRoot()
isRoot.
public boolean isUNC()
isUNC.
public boolean isValidPath(String path)
isValidPath.
path - a String object.public boolean isValidSegment(String segment)
isValidSegment.
segment - a String object.public Path makeUNC(boolean toUNC)
makeUNC.
toUNC - a boolean.Path object.public int matchingFirstSegments(Path anotherPath)
matchingFirstSegments.
anotherPath - a Path object.public Path removeFirstSegments(int count)
removeFirstSegments.
count - a int.Path object.public Path removeLastSegments(int count)
removeLastSegments.
count - a int.Path object.public Path removeTrailingSeparator()
removeTrailingSeparator.
Path object.public String segment(int index)
segment.
index - a int.String object.public int segmentCount()
segmentCount.
public String toString()
toString.
Copyright © 2015 Mulesoft. All rights reserved.