TextResource

API Documentation:TextResource

Note: This class is incubating and may change in a future version of Gradle.

A read-only body of text backed by a string, file, archive entry, or other source. To create a text resource, use one of the factory methods in TextResourceFactory (e.g. project.resources.text.fromFile(myFile)).

Properties

No properties

Methods

MethodDescription
asFile()
Incubating

Same as asFile(Charset.defaultCharset().name()).

asFile(charset)
Incubating

Returns a file containing the resource's text and using the given character encoding. If this resource is backed by a file with a matching encoding, that file may be returned. Otherwise, a temporary file will be created and returned.

asReader()
Incubating

Returns a reader that allows to read the resource's text.

asString()
Incubating

Returns a string containing the resource's text

Script blocks

No script blocks

Method details

File asFile()

Note: This method is incubating and may change in a future version of Gradle.

Same as asFile(Charset.defaultCharset().name()).

File asFile(String charset)

Note: This method is incubating and may change in a future version of Gradle.

Returns a file containing the resource's text and using the given character encoding. If this resource is backed by a file with a matching encoding, that file may be returned. Otherwise, a temporary file will be created and returned.

Reader asReader()

Note: This method is incubating and may change in a future version of Gradle.

Returns a reader that allows to read the resource's text.

String asString()

Note: This method is incubating and may change in a future version of Gradle.

Returns a string containing the resource's text