Package org.gradle.api.resources
Schnittstelle TextResource
- Alle Superschnittstellen:
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)).- Seit:
- 2.2
-
Methodenübersicht
Modifizierer und TypMethodeBeschreibungasFile()Same asasFile(Charset.defaultCharset().name()).Returns a file containing the resource's text and using the given character encoding.asReader()Returns an unbufferedReaderthat allows the resource's text to be read.asString()Returns a string containing the resource's textReturns a dependency which contains the tasks which build this artifact.Returns the input files registered when this resource is used as task input.Returns the input properties registered when this resource is used as task input.
-
Methodendetails
-
asString
String asString()Returns a string containing the resource's text- Gibt zurück:
- a string containing the resource's text
-
asReader
Reader asReader()Returns an unbufferedReaderthat allows the resource's text to be read. The caller is responsible for closing the reader.- Gibt zurück:
- a reader that allows the resource's text to be read.
-
asFile
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.- Parameter:
charset- a character encoding (e.g."utf-8")- Gibt zurück:
- a file containing the resource's text and using the given character encoding
-
asFile
File asFile()Same asasFile(Charset.defaultCharset().name()). -
getInputProperties
Returns the input properties registered when this resource is used as task input. Not typically used directly.- Gibt zurück:
- the input properties registered when this resource is used as task input
-
getInputFiles
Returns the input files registered when this resource is used as task input. Not typically used directly.- Gibt zurück:
- the input files registered when this resource is used as task input
-
getBuildDependencies
Beschreibung aus Schnittstelle kopiert:BuildableReturns a dependency which contains the tasks which build this artifact. AllBuildableimplementations must ensure that the returned dependency object is live, so that it tracks changes to the dependencies of this buildable.- Angegeben von:
getBuildDependenciesin SchnittstelleBuildable- Gibt zurück:
- The dependency. Never returns null. Returns an empty dependency when this artifact is not built by any tasks.
-