@NonExtensible interface FileCopyDetails : FileTreeElement, ContentFilterable
Provides details about a file or directory about to be copied, and allows some aspects of the destination file to be modified.
Using this interface, you can change the destination path of the file, filter the content of the file, or exclude the file from the result entirely.
Access to the source file itself after any filters have been added is not a supported operation.
abstract fun exclude(): Unit
Excludes this file from the copy. |
|
abstract fun getDuplicatesStrategy(): DuplicatesStrategy
The strategy to use if there is already a file at this file's destination. The value can be set with a case insensitive string of the enum value (e.g. |
|
abstract fun getName(): String
Returns the base name of this file at the copy destination. |
|
abstract fun getPath(): String
Returns the path of this file, relative to the root of the copy destination. Always uses '/' as the hierarchy separator, regardless of platform file separator. Same as calling |
|
abstract fun getRelativePath(): RelativePath
Returns the path of this file, relative to the root of the copy destination. |
|
abstract fun getRelativeSourcePath(): RelativePath
Returns the path of this file, relative to the root of the containing file tree. |
|
abstract fun getSourceName(): String
Returns the base name of this file at the copy source. |
|
abstract fun getSourcePath(): String
Returns the path of this file, relative to the root of the containing file tree. Always uses '/' as the hierarchy separator, regardless of platform file separator. Same as calling |
|
abstract fun setDuplicatesStrategy(strategy: DuplicatesStrategy): Unit
The strategy to use if there is already a file at this file's destination. |
|
abstract fun setMode(mode: Int): Unit
Sets the Unix permissions of this file. |
|
abstract fun setName(name: String): Unit
Sets the destination name of this file. |
|
abstract fun setPath(path: String): Unit
Sets the destination path of this file. |
|
abstract fun setRelativePath(path: RelativePath): Unit
Sets the destination path of this file. |
abstract fun copyTo(output: OutputStream): Unit
Copies the content of this file to an output stream. Generally, calling this method is more performant than calling abstract fun copyTo(target: File): Boolean
Copies this file to the given target file. Does not copy the file if the target is already a copy of this file. |
|
abstract fun expand(properties: MutableMap<String, *>): ContentFilterable
Expands property references in each file as it is copied. More specifically, each file is transformed using Groovy's groovy.text.SimpleTemplateEngine. This means you can use simple property references, such as |
|
abstract fun filter(properties: MutableMap<String, *>, filterType: Class<out FilterReader>): ContentFilterable
Adds a content filter to be used during the copy. Multiple calls to filter, add additional filters to the filter chain. Each filter should implement Filter properties may be specified using groovy map syntax. Examples:
abstract fun filter(filterType: Class<out FilterReader>): ContentFilterable
Adds a content filter to be used during the copy. Multiple calls to filter, add additional filters to the filter chain. Each filter should implement Examples:
abstract fun filter(closure: Closure<Any>): ContentFilterable
Adds a content filter based on the provided closure. The Closure will be called with each line (stripped of line endings) and should return a String to replace the line or abstract fun filter(transformer: Transformer<String, String>): ContentFilterable
Adds a content filter based on the provided transformer. The Closure will be called with each line (stripped of line endings) and should return a String to replace the line or |
|
abstract fun getFile(): File
Returns the file being visited. |
|
abstract fun getLastModified(): Long
Returns the last modified time of this file at the time of file traversal. |
|
abstract fun getMode(): Int
Returns the Unix permissions of this file, e.g. |
|
abstract fun getSize(): Long
Returns the size of this file at the time of file traversal. |
|
abstract fun isDirectory(): Boolean
Returns true if this element is a directory, or false if this element is a regular file. |
|
abstract fun open(): InputStream
Opens this file as an input stream. Generally, calling this method is more performant than calling |