Class PathUtils

java.lang.Object
uk.blankaspect.common.filesystem.PathUtils

public class PathUtils extends Object
This class contains utility methods that relate to file-system locations.
  • Method Summary

    Modifier and Type
    Method
    Description
    static Path
    abs(Path location)
    Converts the specified file-system location to a normalised absolute location and returns the result.
    static Path
    absParent(Path location)
    Converts the specified file-system location to a normalised absolute location and returns the parent of the resulting location.
    static String
    absString(Path location)
    Converts the specified file-system location to a normalised absolute location and returns a string representation of the resulting location.
    static String
    absStringStd(Path location)
    Converts the specified file-system location to a normalised absolute location and returns a string representation of the resulting location in which the system-dependent separators between adjacent components are replaced by Unix separators, '/'.
    static List<Path>
    convertLocations(Iterable<? extends File> files)
    Returns a list of Paths in which each element corresponds to an element of the specified input sequence of Files.
    static String
    join(Iterable<? extends Path> locations)
    Concatenates the string representations of the specified locations, with adjacent locations separated by the system-dependent separator character, and returns the resulting string.
    static String
    join(Path... locations)
    Concatenates the string representations of the specified locations, with adjacent locations separated by the system-dependent separator character, and returns the resulting string.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • abs

      public static Path abs(Path location)
      Converts the specified file-system location to a normalised absolute location and returns the result. The following methods are called sequentially on the input location:
      Parameters:
      location - the location of interest.
      Returns:
      location converted to an absolute location and normalised.
    • absParent

      public static Path absParent(Path location)
      Converts the specified file-system location to a normalised absolute location and returns the parent of the resulting location. The following methods are called sequentially on the input location:
      Parameters:
      location - the location of interest.
      Returns:
      the parent of location after it is converted to an absolute location and normalised.
    • absString

      public static String absString(Path location)
      Converts the specified file-system location to a normalised absolute location and returns a string representation of the resulting location. The following methods are called sequentially on the input location:
      Parameters:
      location - the location of interest.
      Returns:
      a string representation of location after it is converted to an absolute location and normalised.
    • absStringStd

      public static String absStringStd(Path location)
      Converts the specified file-system location to a normalised absolute location and returns a string representation of the resulting location in which the system-dependent separators between adjacent components are replaced by Unix separators, '/'. The following methods are called sequentially on the input location:
      Parameters:
      location - the location of interest.
      Returns:
      a string representation of location after it is converted to an absolute location and normalised. In the string representation, the system-dependent separators between adjacent components are replaced by Unix separators, '/'.
    • join

      public static String join(Path... locations)
      Concatenates the string representations of the specified locations, with adjacent locations separated by the system-dependent separator character, and returns the resulting string.
      Parameters:
      locations - the locations that will be concatenated.
      Returns:
      a concatenation of the string representations of locations, with adjacent locations separated by the system-dependent separator character.
    • join

      public static String join(Iterable<? extends Path> locations)
      Concatenates the string representations of the specified locations, with adjacent locations separated by the system-dependent separator character, and returns the resulting string.
      Parameters:
      locations - the locations that will be concatenated.
      Returns:
      a concatenation of the string representations of locations, with adjacent locations separated by the system-dependent separator character.
    • convertLocations

      public static List<Path> convertLocations(Iterable<? extends File> files)
      Returns a list of Paths in which each element corresponds to an element of the specified input sequence of Files.
      Parameters:
      files - the locations that will be converted.
      Returns:
      a list of Paths in which each element corresponds to an element of the input sequence.