public class Path extends Object
../../) and duplicate separators are resolved. For
example,
new Path("/a/b").append("../foo/bar")
will yield the path
/a/foo/bar
This class is not intended to be subclassed by clients but may be instantiated.
| 限定符和类型 | 字段和说明 |
|---|---|
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.
|
| 构造器和说明 |
|---|
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.
|
| 限定符和类型 | 方法和说明 |
|---|---|
static String |
getRelativePath(Path fullPath,
Path fBasePath) |
boolean |
isAbsolute() |
int |
matchingFirstSegments(Path anotherPath) |
String |
segment(int index) |
int |
segmentCount() |
String[] |
segments() |
Path |
setDevice(String value) |
String |
toOSString() |
public static final char SEPARATOR
public static final char DEVICE_SEPARATOR
public static final Path ROOT
public static final Path EMPTY
public Path(String fullPath)
fullPath - the string pathpublic Path(String device, String path)
device - the device idpath - the string pathsetDevice(java.lang.String)Copyright © 2023 onecode. All rights reserved.