类 ResourceScriptSource
java.lang.Object
cn.taketoday.scripting.support.ResourceScriptSource
- 所有已实现的接口:
ScriptSource
ScriptSource implementation
based on Framework's 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).- 从以下版本开始:
- 4.0
- 作者:
- Rob Harrop, Juergen Hoeller
- 另请参阅:
-
InputStreamSource.getInputStream()Resource.getFile()ResourceLoader
-
构造器概要
构造器构造器说明ResourceScriptSource(cn.taketoday.core.io.EncodedResource resource) Create a new ResourceScriptSource for the given resource.ResourceScriptSource(cn.taketoday.core.io.Resource resource) Create a new ResourceScriptSource for the given resource. -
方法概要
修饰符和类型方法说明final cn.taketoday.core.io.ResourceReturn theResourceto load the script from.Retrieve the current script source text as String.booleanIndicate whether the underlying script data has been modified since the last timeScriptSource.getScriptAsString()was called.protected longRetrieve the current last-modified timestamp of the underlying resource.voidsetEncoding(String encoding) Set the encoding used for reading the script resource.Determine a class name for the underlying script.toString()
-
构造器详细资料
-
ResourceScriptSource
public ResourceScriptSource(cn.taketoday.core.io.EncodedResource resource) Create a new ResourceScriptSource for the given resource.- 参数:
resource- the EncodedResource to load the script from
-
ResourceScriptSource
public ResourceScriptSource(cn.taketoday.core.io.Resource resource) Create a new ResourceScriptSource for the given resource.- 参数:
resource- the Resource to load the script from (using UTF-8 encoding)
-
-
方法详细资料
-
getResource
public final cn.taketoday.core.io.Resource getResource()Return theResourceto load the script from. -
setEncoding
Set the encoding used for reading the script resource.The default value for regular Resources is "UTF-8". A
nullvalue implies the platform default. -
getScriptAsString
从接口复制的说明:ScriptSourceRetrieve the current script source text as String.- 指定者:
getScriptAsString在接口中ScriptSource- 返回:
- the script text
- 抛出:
IOException- if script retrieval failed
-
isModified
public boolean isModified()从接口复制的说明:ScriptSourceIndicate whether the underlying script data has been modified since the last timeScriptSource.getScriptAsString()was called. Returnstrueif the script has not been read yet.- 指定者:
isModified在接口中ScriptSource- 返回:
- whether the script data has been modified
-
retrieveLastModifiedTime
protected long retrieveLastModifiedTime()Retrieve the current last-modified timestamp of the underlying resource.- 返回:
- the current timestamp, or 0 if not determinable
-
suggestedClassName
从接口复制的说明:ScriptSourceDetermine a class name for the underlying script.- 指定者:
suggestedClassName在接口中ScriptSource- 返回:
- the suggested class name, or
nullif none available
-
toString
-