本文整理汇总了Java中org.mozilla.javascript.ScriptRuntime.toUint32方法的典型用法代码示例。如果您正苦于以下问题:Java ScriptRuntime.toUint32方法的具体用法?Java ScriptRuntime.toUint32怎么用?Java ScriptRuntime.toUint32使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.mozilla.javascript.ScriptRuntime
的用法示例。
在下文中一共展示了ScriptRuntime.toUint32方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: loadFromPathArray
import org.mozilla.javascript.ScriptRuntime; //导入方法依赖的package包/类
private ModuleSource loadFromPathArray(String moduleId,
Scriptable paths, Object validator) throws IOException
{
final long llength = ScriptRuntime.toUint32(
ScriptableObject.getProperty(paths, "length"));
// Yeah, I'll ignore entries beyond Integer.MAX_VALUE; so sue me.
int ilength = llength > Integer.MAX_VALUE ? Integer.MAX_VALUE :
(int)llength;
for(int i = 0; i < ilength; ++i) {
final String path = ensureTrailingSlash(
ScriptableObject.getTypedProperty(paths, i, String.class));
try {
URI uri = new URI(path);
if (!uri.isAbsolute()) {
uri = new File(path).toURI().resolve("");
}
final ModuleSource moduleSource = loadFromUri(
uri.resolve(moduleId), uri, validator);
if(moduleSource != null) {
return moduleSource;
}
}
catch(URISyntaxException e) {
throw new MalformedURLException(e.getMessage());
}
}
return null;
}
示例2: loadFromPathArray
import org.mozilla.javascript.ScriptRuntime; //导入方法依赖的package包/类
private ModuleSource loadFromPathArray(String moduleId,
Scriptable paths, Object validator) throws IOException
{
final long llength = ScriptRuntime.toUint32(
ScriptableObject.getProperty(paths, "length"));
// Yeah, I'll ignore entries beyond Integer.MAX_VALUE; so sue me.
int ilength = llength > Integer.MAX_VALUE ? Integer.MAX_VALUE :
(int)llength;
for(int i = 0; i < ilength; ++i) {
final String path = ensureTrailingSlash(
ScriptableObject.getTypedProperty(paths, i, String.class));
try {
URI uri = new URI(path);
if (!uri.isAbsolute()) {
uri = new File(path).toURI().resolve("");
}
final ModuleSource moduleSource = loadFromUri(
uri.resolve(moduleId), uri, validator);
if(moduleSource != null) {
return moduleSource;
}
}
catch(URISyntaxException e) {
throw new MalformedURLException(e.getMessage());
}
}
return null;
}