spring-framework / org.springframework.scripting.support / ResourceScriptSource

ResourceScriptSource

open class ResourceScriptSource : ScriptSource

org.springframework.scripting.ScriptSource implementation based on Spring's org.springframework.core.io.Resource abstraction. Loads the script text from the underlying Resource's File or InputStream, and tracks the last-modified timestamp of the file (if possible).

Author
Rob Harrop

Author
Juergen Hoeller

Since
2.0

See Also
org.springframework.core.io.Resource#getInputStream()org.springframework.core.io.Resource#getFile()org.springframework.core.io.ResourceLoader

Constructors

<init>

ResourceScriptSource(resource: EncodedResource)
ResourceScriptSource(resource: Resource)

Create a new ResourceScriptSource for the given resource.

Functions

getResource

fun getResource(): Resource

Return the org.springframework.core.io.Resource to load the script from.

getScriptAsString

open fun getScriptAsString(): String

isModified

open fun isModified(): Boolean

setEncoding

open fun setEncoding(encoding: String): Unit

Set the encoding used for reading the script resource.

The default value for regular Resources is "UTF-8". A null value implies the platform default.

suggestedClassName

open fun suggestedClassName(): String

toString

open fun toString(): String