api / org.gradle.api.file / RelativePath

RelativePath

open class RelativePath : Serializable, Comparable<RelativePath>, CharSequence

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

<init>

RelativePath(endsWithFile: Boolean, vararg segments: String)

Creates a RelativePath.

Properties

EMPTY_ROOT

static val EMPTY_ROOT: RelativePath

length

open val length: Int

Functions

append

open fun append(other: RelativePath): RelativePath

Appends the given path to the end of this path.

open fun append(endsWithFile: Boolean, vararg segments: String): RelativePath

Appends the given names to the end of this path.

compareTo

open fun compareTo(other: RelativePath): Int

equals

open fun equals(other: Any?): Boolean

get

open fun get(index: Int): Char

getFile

open fun getFile(baseDir: File): File

getLastName

open fun getLastName(): String

getParent

open fun getParent(): RelativePath

Returns the parent of this path.

getPathString

open fun getPathString(): String

getSegments

open fun getSegments(): Array<String>

hashCode

open fun hashCode(): Int

isFile

open fun isFile(): Boolean

parse

open static fun parse(isFile: Boolean, path: String): RelativePath
open static fun parse(isFile: Boolean, parent: RelativePath, path: String): RelativePath

plus

open fun plus(other: RelativePath): RelativePath

Appends the given path to the end of this path.

prepend

open fun prepend(vararg segments: String): RelativePath

Prepends the given names to the start of this path.

replaceLastName

open fun replaceLastName(name: String): RelativePath

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

segmentIterator

open fun segmentIterator(): MutableListIterator<String>

subSequence

open fun subSequence(startIndex: Int, endIndex: Int): CharSequence

toString

open fun toString(): String