public class SimplePath extends Object implements Comparable<SimplePath>, Path, Serializable
Modifier and Type | Field and Description |
---|---|
static String[] |
EMPTY |
static SimplePath |
ROOT |
Constructor and Description |
---|
SimplePath(CharSequence path) |
SimplePath(CharSequence path,
boolean allowSloshes) |
SimplePath(List<String> start) |
SimplePath(Path path) |
SimplePath(SimplePath aParent,
SimplePath aPath) |
SimplePath(SimplePath aParent,
String... aPath) |
SimplePath(SimplePath aParent,
String aPath) |
SimplePath(SimplePath aParent,
String aPath,
boolean allowSloshes) |
SimplePath(String aParent,
SimplePath aPath) |
Modifier and Type | Method and Description |
---|---|
SimplePath |
abbreviate(int maxLength)
Abbreviates the path by removing path components from the middle until the length of the
path
is not greater than maxLength . |
SimplePath[] |
abbreviatePathComponents(int maxLength)
Returns a similar result to
getPathComponents() , but abbreviates
the result (inserts null at the break point) |
int |
compareTo(SimplePath o) |
boolean |
equals(Object o) |
SimplePath |
getCommonRoot(SimplePath other) |
String |
getComponent(int i) |
String[] |
getComponents() |
String |
getExtension() |
String |
getName() |
int |
getNumComponents() |
String |
getParent() |
SimplePath |
getParentPath() |
String |
getPath() |
String |
getPath(boolean caseSensitive) |
SimplePath[] |
getPathComponents() |
SimplePath |
getPathHead() |
SimplePath |
getStripTail(SimplePath other,
boolean caseSensitive)
if other is an exact tail of this, return the path leading up to that
tail otherwise return null
|
SimplePath |
getSubPath(int depth) |
String |
getTail() |
SimplePath |
getTailPath() |
int |
hashCode() |
boolean |
hasPrefix(SimplePath p)
determines if this path begins with all of
p |
boolean |
hasPrefix(SimplePath p,
boolean caseSensitive) |
boolean |
isAncestor(SimplePath descendant) |
boolean |
isRoot() |
static String |
join(String a,
String b)
Intelligently put a "/" between two strings.
|
SimplePath |
simplify() |
static String[] |
split(CharSequence aPath) |
static String[] |
split(CharSequence aPath,
boolean allowSloshes) |
String |
toString() |
SimplePath |
trimFirst() |
SimplePath |
trimFirst(int n) |
SimplePath |
trimLast() |
public static final String[] EMPTY
public static final SimplePath ROOT
public SimplePath(Path path)
public SimplePath(CharSequence path)
public SimplePath(CharSequence path, boolean allowSloshes)
public SimplePath(SimplePath aParent, String aPath)
public SimplePath(SimplePath aParent, String... aPath)
public SimplePath(SimplePath aParent, SimplePath aPath)
public SimplePath(SimplePath aParent, String aPath, boolean allowSloshes)
public SimplePath(String aParent, SimplePath aPath)
public static String join(String a, String b)
a
- first path componentb
- second path componentpublic static String[] split(CharSequence aPath)
public static String[] split(CharSequence aPath, boolean allowSloshes)
public SimplePath abbreviate(int maxLength)
path
is not greater than maxLength
.
The first and last path component are always in the returned path. If any path components are removed, an
ellipses ("...") will appear in the middle. The returned path may in some cases still be greater than the
specified maxLength
.
maxLength
- maximum number of characterspublic SimplePath[] abbreviatePathComponents(int maxLength)
getPathComponents()
, but abbreviates
the result (inserts null at the break point)maxLength
- maximum lengthpublic int compareTo(SimplePath o)
compareTo
in interface Comparable<SimplePath>
public SimplePath getCommonRoot(SimplePath other)
public String getComponent(int i)
@Nonnull public String[] getComponents()
getComponents
in interface Path
public String getExtension()
getExtension
in interface Path
public int getNumComponents()
public String getParent()
public SimplePath getParentPath()
public String getPath()
public String getPath(boolean caseSensitive)
public SimplePath[] getPathComponents()
public SimplePath getPathHead()
public SimplePath getStripTail(SimplePath other, boolean caseSensitive)
other
- the other pathcaseSensitive
- true if case sensitivenull
if the other path is not a tail of this pathpublic SimplePath getSubPath(int depth)
public String getTail()
public SimplePath getTailPath()
public boolean hasPrefix(SimplePath p)
p
p
- the prefix to checkpublic boolean hasPrefix(SimplePath p, boolean caseSensitive)
public boolean isAncestor(SimplePath descendant)
public boolean isRoot()
public SimplePath simplify()
public SimplePath trimFirst()
public SimplePath trimFirst(int n)
n
- number of components to trimpublic SimplePath trimLast()
Copyright © 2022 Atlassian. All rights reserved.