# TextResource

interface TextResource : Buildable(source)

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)`).

#### Since

2.2

## Functions

asFile
Link copied to clipboard
abstract fun asFile(): File
Same as `asFile(Charset.defaultCharset().name())`.
abstract fun asFile(charset: String): File
Returns a file containing the resource's text and using the given character encoding.
asReader
Link copied to clipboard
abstract fun asReader(): Reader
Returns an unbuffered Reader that allows the resource's text to be read.
asString
Link copied to clipboard
abstract fun asString(): String
Returns a string containing the resource's text
getBuildDependencies
Link copied to clipboard
@Internal
abstract fun getBuildDependencies(): TaskDependency
getInputFiles
Link copied to clipboard
@Nullable
@Optional
@PathSensitive(value = PathSensitivity.NONE)
@InputFiles
abstract fun getInputFiles(): @Nullable FileCollection
Returns the input files registered when this resource is used as task input.
getInputProperties
Link copied to clipboard
@Nullable
@Optional
@Input
abstract fun getInputProperties(): @Nullable Any
Returns the input properties registered when this resource is used as task input.