Package org.eclipse.osgi.framework.util
Class FilePath
java.lang.Object
org.eclipse.osgi.framework.util.FilePath
A utility class for manipulating file system paths.
This class is not intended to be subclassed by clients but may be instantiated.
- Since:
- 3.1
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionReturns the device for this file system path, ornull
if none exists.String[]
Returns the segments in this path.boolean
Returns whether this path ends with a slash.boolean
Returns whether this path is absolute (begins with a slash).makeRelative
(FilePath base) Returns a string representing this path as a relative to the given base path.toString()
Returns a string representation of this path.
-
Constructor Details
-
FilePath
Constructs a new file path from the given File object. -
FilePath
Constructs a new file path from the given string path.
-
-
Method Details
-
getDevice
Returns the device for this file system path, ornull
if none exists. The device string ends with a colon.- Returns:
- the device string or null
-
getSegments
Returns the segments in this path. If this path has no segments, returns an empty array.- Returns:
- an array containing all segments for this path
-
hasTrailingSlash
public boolean hasTrailingSlash()Returns whether this path ends with a slash.- Returns:
true
if the path ends with a slash, false otherwise
-
isAbsolute
public boolean isAbsolute()Returns whether this path is absolute (begins with a slash).- Returns:
true
if this path is absolute,false
otherwise
-
makeRelative
Returns a string representing this path as a relative to the given base path.If this path and the given path do not use the same device letter, this path's string representation is returned as is.
- Parameters:
base
- the path this path should be made relative to- Returns:
- a string representation for this path as relative to the given base path
-
toString
Returns a string representation of this path.
-