Package org.gradle.api.file
Class RelativePath
java.lang.Object
org.gradle.api.file.RelativePath
- All Implemented Interfaces:
- Serializable,- CharSequence,- Comparable<RelativePath>
public class RelativePath
extends Object
implements 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.
- See Also:
- 
Field SummaryFields
- 
Constructor SummaryConstructorsConstructorDescriptionRelativePath(boolean endsWithFile, String... segments) Creates aRelativePath.
- 
Method SummaryModifier and TypeMethodDescriptionAppends the given names to the end of this path.append(RelativePath other) Appends the given path to the end of this path.charcharAt(int index) intbooleanReturns the parent of this path.String[]inthashCode()booleanisFile()intlength()static RelativePathstatic RelativePathparse(boolean isFile, RelativePath parent, String path) plus(RelativePath other) Appends the given path to the end of this path.Prepends the given names to the start of this path.replaceLastName(String name) Returns a copy of this path, with the last name replaced with the given name.subSequence(int start, int end) toString()Methods inherited from class java.lang.Objectclone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.CharSequencechars, codePoints, isEmpty
- 
Field Details- 
EMPTY_ROOT
 
- 
- 
Constructor Details- 
RelativePathCreates aRelativePath.- Parameters:
- endsWithFile- - if true, the path ends with a file, otherwise a directory
 
 
- 
- 
Method Details- 
getSegments
- 
segmentIterator
- 
isFilepublic boolean isFile()
- 
getPathString
- 
lengthpublic int length()- Specified by:
- lengthin interface- CharSequence
 
- 
charAtpublic char charAt(int index) - Specified by:
- charAtin interface- CharSequence
 
- 
subSequence- Specified by:
- subSequencein interface- CharSequence
 
- 
getFile
- 
getLastName
- 
equals
- 
hashCodepublic int hashCode()
- 
toString- Specified by:
- toStringin interface- CharSequence
- Overrides:
- toStringin class- Object
 
- 
getParentReturns the parent of this path.- Returns:
- The parent of this path, or null if this is the root path.
 
- 
parse
- 
parse
- 
replaceLastNameReturns a copy of this path, with the last name replaced with the given name. - Parameters:
- name- The name.
- Returns:
- The path.
 
- 
appendAppends the given path to the end of this path. - Parameters:
- other- The path to append
- Returns:
- The new path
 
- 
plusAppends the given path to the end of this path. - Parameters:
- other- The path to append
- Returns:
- The new path
 
- 
appendAppends the given names to the end of this path.- Parameters:
- endsWithFile- when true, the new path refers to a file.
- segments- The names to append.
- Returns:
- The new path.
 
- 
prependPrepends the given names to the start of this path.- Parameters:
- segments- The names to prepend
- Returns:
- The new path.
 
- 
compareTo- Specified by:
- compareToin interface- Comparable<RelativePath>
 
 
-