org.gradle.api.resources

## Interface TextResource

- All Superinterfaces:
    Buildable

      @Incubating
      public interface TextResource
      extends Buildable

  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

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `File` | `asFile()` Same as `asFile(Charset.defaultCharset().name())`.
    `File` | `asFile(String charset)` Returns a file containing the resource's text and using the given character encoding.
    `Reader` | `asReader()` Returns a reader that allows to read the resource's text.
    `String` | `asString()` Returns a string containing the resource's text
    `FileCollection` | `getInputFiles()` Returns the input files registered when this resource is used as task input.
    `Object` | `getInputProperties()` Returns the input properties registered when this resource is used as task input.

    - ### Methods inherited from interface org.gradle.api.Buildable

      `getBuildDependencies`

- - ### Method Detail

    - #### asString

          String asString()

      Returns a string containing the resource's text
      Returns:
        a string containing the resource's text

    - #### asReader

          Reader asReader()

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

    - #### asFile

          File asFile(String charset)

      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.
      Parameters:
        `charset` - a character encoding (e.g. `"utf-8"`)
      Returns:
        a file containing the resource's text and using the given character encoding

    - #### asFile

          File asFile()

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

    - #### getInputProperties

          @Input
          @Optional
          Object getInputProperties()

      Returns the input properties registered when this resource is used as task input. Not typically used directly.
      Returns:
        the input properties registered when this resource is used as task input

    - #### getInputFiles

          @InputFiles
          @Optional
          FileCollection getInputFiles()

      Returns the input files registered when this resource is used as task input. Not typically used directly.
      Returns:
        the input files registered when this resource is used as task input