Class RelativePath

    • Field Detail

    • Constructor Detail

      • RelativePath

        public RelativePath​(boolean endsWithFile,
                            String... segments)
        Creates a RelativePath.
        Parameters:
        endsWithFile - - if true, the path ends with a file, otherwise a directory
    • Method Detail

      • getSegments

        public String[] getSegments()
      • isFile

        public boolean isFile()
      • getPathString

        public String getPathString()
      • getFile

        public File getFile​(File baseDir)
      • getLastName

        public String getLastName()
      • hashCode

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

        public RelativePath getParent()
        Returns the parent of this path.
        Returns:
        The parent of this path, or null if this is the root path.
      • replaceLastName

        public RelativePath replaceLastName​(String name)

        Returns a copy of this path, with the last name replaced with the given name.

        Parameters:
        name - The name.
        Returns:
        The path.
      • append

        public RelativePath append​(RelativePath other)

        Appends the given path to the end of this path.

        Parameters:
        other - The path to append
        Returns:
        The new path
      • plus

        public RelativePath plus​(RelativePath other)

        Appends the given path to the end of this path.

        Parameters:
        other - The path to append
        Returns:
        The new path
      • append

        public RelativePath append​(boolean endsWithFile,
                                   String... segments)
        Appends the given names to the end of this path.
        Parameters:
        segments - The names to append.
        endsWithFile - when true, the new path refers to a file.
        Returns:
        The new path.
      • prepend

        public RelativePath prepend​(String... segments)
        Prepends the given names to the start of this path.
        Parameters:
        segments - The names to prepend
        Returns:
        The new path.