Class PathUtility


  • public class PathUtility
    extends Object
    Utility methods for dealing with Hadoop style paths.
    • Constructor Detail

      • PathUtility

        public PathUtility()
    • Method Detail

      • fileSystemPath

        public static String fileSystemPath​(String path)
        Convert a full URL style path in the root file system path.
        Parameters:
        path - HDFS style path
        Returns:
        root filesystem path
      • filePath

        public static String filePath​(String path)
        Convert a URL style path into it's normalized form. This ensures the format fits a stricter URL form, i.e. hdfs:///path.
        Parameters:
        path - HDFS style path
        Returns:
        normalized path
      • getParent

        public static String getParent​(String path)
        Get the parent directory of the given path.
        Parameters:
        path - Hadoop style path
        Returns:
        given path minus the lowest file segment
      • resolve

        public static String resolve​(String path,
                                     String other)
        Resolve the given path and the path segment to be appended. Returns the given path plus the path segment merged together to resolve issues with the base path and path separators.
        Parameters:
        path - input (base) path
        other - a path segment to append
        Returns:
        the resolved path
      • getName

        public static String getName​(String path)
        Get the last file segment of the given path.
        Parameters:
        path - full URL style path
        Returns:
        the last file segment (or "/" if already root)