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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddFileExtension(String extension) static PathcreateFromAbsolutePath(String path) Creates a path object from an absolute and canonical path.static PathcreateFromSegments(String[] segments) booleanstatic StringgetFileNameFromPath(String iconPath) Gets the name of the icon file so that it can be displayed as alt text.inthashCode()booleanbooleanbooleanisEmpty()booleanisPrefixOf(Path anotherPath) booleanisRoot()static booleanisValidPath(String path) intmatchingFirstSegments(Path anotherPath) removeFirstSegments(int count) removeLastSegments(int count) segment(int index) intString[]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.
-