# filter

abstract fun filter(properties: Map<String, out Any>, 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 `java.io.FilterReader`. Include `org.apache.tools.ant.filters.*` for access to all the standard Ant filters.

Filter properties may be specified using groovy map syntax.

Examples:

       filter(HeadFilter, lines:25, skip:2)
       filter(ReplaceTokens, tokens:[copyright:'2009', version:'2.3.1'])

Content copied to clipboard

#### Return

this

#### Parameters

properties

map of filter properties

filterType

Class of filter to add

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 `java.io.FilterReader`. Include `org.apache.tools.ant.filters.*` for access to all the standard Ant filters.

Examples:

       filter(StripJavaComments)
       filter(com.mycompany.project.CustomFilter)

Content copied to clipboard

#### Return

this

#### Parameters

filterType

Class of filter to add

abstract fun filter(closure: Closure): 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 `null` to remove the line. If every line is removed, the result will be an empty file, not an absent one.

#### Return

this

#### Parameters

closure

to implement line based filtering

abstract fun filter(transformer: Transformer<@Nullable 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 `null` to remove the line. If every line is removed, the result will be an empty file, not an absent one.

#### Return

this

#### Parameters

transformer

to implement line based filtering