# RelativePath

open class RelativePath : Serializable, Comparable<T> , CharSequence(source)

Represents a relative path from some base directory to a file. Used in file copying to represent both a source and target file path when copying files.

`RelativePath` instances are immutable.

## Constructors

RelativePath
Link copied to clipboard
constructor(endsWithFile: Boolean, segments: Array<String>)
Creates a `RelativePath`.

## Properties

EMPTY_ROOT
Link copied to clipboard
val EMPTY_ROOT: RelativePath
segments
Link copied to clipboard
val segments: Array<String>

## Functions

append
Link copied to clipboard
open fun append(other: RelativePath): RelativePath
Appends the given path to the end of this path.
open fun append(endsWithFile: Boolean, segments: Array<String>): RelativePath
Appends the given names to the end of this path.
charAt
Link copied to clipboard
open fun charAt(index: Int): Char
chars
Link copied to clipboard
open fun chars(): IntStream
codePoints
Link copied to clipboard
open fun codePoints(): IntStream
compare
Link copied to clipboard
open fun compare(cs1: CharSequence, cs2: CharSequence): Int
compareTo
Link copied to clipboard
open fun compareTo(o: RelativePath): Int
equals
Link copied to clipboard
open fun equals(o: Any): Boolean
getFile
Link copied to clipboard
open fun getFile(baseDir: File): File
getLastName
Link copied to clipboard
open fun getLastName(): String
getParent
Link copied to clipboard
open fun getParent(): RelativePath
Returns the parent of this path.
getPathString
Link copied to clipboard
open fun getPathString(): String
hashCode
Link copied to clipboard
open fun hashCode(): Int
isEmpty
Link copied to clipboard
open fun isEmpty(): Boolean
isFile
Link copied to clipboard
open fun isFile(): Boolean
length
Link copied to clipboard
open fun length(): Int
parse
Link copied to clipboard
open fun parse(isFile: Boolean, path: String): RelativePath
open fun parse(isFile: Boolean, @Nullable parent: RelativePath, path: String): RelativePath
plus
Link copied to clipboard
open fun plus(other: RelativePath): RelativePath
Appends the given path to the end of this path.
prepend
Link copied to clipboard
open fun prepend(segments: Array<String>): RelativePath
Prepends the given names to the start of this path.
replaceLastName
Link copied to clipboard
open fun replaceLastName(name: String): RelativePath
Returns a copy of this path, with the last name replaced with the given name.
segmentIterator
Link copied to clipboard
open fun segmentIterator(): ListIterator<String>
subSequence
Link copied to clipboard
open fun subSequence(start: Int, end: Int): CharSequence
toString
Link copied to clipboard
open fun toString(): String