# RelativePath

open class RelativePath : Serializable, Comparable<RelativePath> , 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.

#### Since

0.8

## 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
Relative path.
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
getChars
Link copied to clipboard
open fun getChars(srcBegin: Int, srcEnd: Int, dst: Array<Char>, dstBegin: Int)
getFile
Link copied to clipboard
open fun getFile(baseDir: File): File
Returns the file.
getLastName
Link copied to clipboard
open fun getLastName(): String
Returns the last name.
getParent
Link copied to clipboard
@Nullable
open fun getParent(): @Nullable RelativePath
Returns the parent of this path.
getPathString
Link copied to clipboard
open fun getPathString(): String
Returns the path 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
Returns whether file is set.
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: @Nullable RelativePath, path: String): RelativePath
Parse.
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>
Segment iterator.
subSequence
Link copied to clipboard
open fun subSequence(start: Int, end: Int): CharSequence
toString
Link copied to clipboard
open fun toString(): String