Class Path

java.lang.Object
org.nuxeo.common.utils.Path
All Implemented Interfaces:
Serializable

public class Path extends Object implements Serializable
Contains code from Eclipse org.eclipse.core.runtime.Path class
Author:
Bogdan Stefanescu
See Also:
  • Constructor Details

    • Path

      public Path(String fullPath)
      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

      public static Path createFromAbsolutePath(String path)
      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

      public static Path createFromSegments(String[] segments)
    • addFileExtension

      public Path addFileExtension(String extension)
    • addTrailingSeparator

      public Path addTrailingSeparator()
    • append

      public Path append(Path tail)
    • append

      public Path append(String tail)
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • getFileExtension

      public String getFileExtension()
    • hasTrailingSeparator

      public boolean hasTrailingSeparator()
    • isAbsolute

      public boolean isAbsolute()
    • isEmpty

      public boolean isEmpty()
    • isPrefixOf

      public boolean isPrefixOf(Path anotherPath)
    • isRoot

      public boolean isRoot()
    • isValidPath

      public static boolean isValidPath(String path)
    • lastSegment

      public String lastSegment()
    • makeAbsolute

      public Path makeAbsolute()
    • makeRelative

      public Path makeRelative()
    • matchingFirstSegments

      public int matchingFirstSegments(Path anotherPath)
    • removeFileExtension

      public Path removeFileExtension()
    • removeFirstSegments

      public Path removeFirstSegments(int count)
    • removeLastSegments

      public Path removeLastSegments(int count)
    • removeTrailingSeparator

      public Path removeTrailingSeparator()
    • segment

      public String segment(int index)
    • segmentCount

      public int segmentCount()
    • segments

      public String[] segments()
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • uptoSegment

      public Path uptoSegment(int count)
    • getFileNameFromPath

      public static String getFileNameFromPath(String iconPath)
      Gets the name of the icon file so that it can be displayed as alt text.