Package org.nuxeo.common.utils
Class Path
java.lang.Object
org.nuxeo.common.utils.Path
- All Implemented Interfaces:
Serializable
Contains code from Eclipse org.eclipse.core.runtime.Path class
- Author:
- Bogdan Stefanescu
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionaddFileExtension
(String extension) static Path
createFromAbsolutePath
(String path) Creates a path object from an absolute and canonical path.static Path
createFromSegments
(String[] segments) boolean
static String
getFileNameFromPath
(String iconPath) Gets the name of the icon file so that it can be displayed as alt text.int
hashCode()
boolean
boolean
boolean
isEmpty()
boolean
isPrefixOf
(Path anotherPath) boolean
isRoot()
static boolean
isValidPath
(String path) int
matchingFirstSegments
(Path anotherPath) removeFirstSegments
(int count) removeLastSegments
(int count) segment
(int index) int
String[]
segments()
toString()
uptoSegment
(int count)
-
Constructor Details
-
Path
Constructs a new path from the given string path.The string path must represent a valid file system path on the local file system.
The path is canonicalized and double slashes are removed except at the beginning. (to handle UNC paths). All forward slashes ('/') are treated as segment delimiters, and any segment and device delimiters for the local file system are also respected (such as colon (':') and backslash ('\') on some file systems).
- Parameters:
fullPath
- the string path- See Also:
-
-
Method Details
-
createFromAbsolutePath
Creates a path object from an absolute and canonical path.This method does not check the given path - it assumes the path has a valid format of the form "/a/b/c" without duplicate slashes or dots.
- Returns:
- the path
-
createFromSegments
-
addFileExtension
-
addTrailingSeparator
-
append
-
append
-
equals
-
hashCode
public int hashCode() -
getFileExtension
-
hasTrailingSeparator
public boolean hasTrailingSeparator() -
isAbsolute
public boolean isAbsolute() -
isEmpty
public boolean isEmpty() -
isPrefixOf
-
isRoot
public boolean isRoot() -
isValidPath
-
lastSegment
-
makeAbsolute
-
makeRelative
-
matchingFirstSegments
-
removeFileExtension
-
removeFirstSegments
-
removeLastSegments
-
removeTrailingSeparator
-
segment
-
segmentCount
public int segmentCount() -
segments
-
toString
-
uptoSegment
-
getFileNameFromPath
Gets the name of the icon file so that it can be displayed as alt text.
-