public class FilePath extends Object
This class is not intended to be subclassed by clients but may be instantiated.
Constructor and Description |
---|
FilePath(File location)
Constructs a new file path from the given File object.
|
FilePath(String original)
Constructs a new file path from the given string path.
|
Modifier and Type | Method and Description |
---|---|
String |
getDevice()
Returns the device for this file system path, or
null if
none exists. |
String[] |
getSegments()
Returns the segments in this path.
|
boolean |
hasTrailingSlash()
Returns whether this path ends with a slash.
|
boolean |
isAbsolute()
Returns whether this path is absolute (begins with a slash).
|
String |
makeRelative(FilePath base)
Returns a string representing this path as a relative to the given base path.
|
String |
toString()
Returns a string representation of this path.
|
public FilePath(File location)
location
- public FilePath(String original)
original
- public String getDevice()
null
if
none exists. The device string ends with a colon.public String[] getSegments()
public boolean hasTrailingSlash()
true
if the path ends with a slash, false otherwisepublic boolean isAbsolute()
true
if this path is absolute, false
otherwisepublic String makeRelative(FilePath base)
If this path and the given path do not use the same device letter, this path's string representation is returned as is.
base
- the path this path should be made relative toCopyright © 2007–2018 The Apache Software Foundation. All rights reserved.