本文整理汇总了Java中com.eclipsesource.v8.V8Array.release方法的典型用法代码示例。如果您正苦于以下问题:Java V8Array.release方法的具体用法?Java V8Array.release怎么用?Java V8Array.release使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.eclipsesource.v8.V8Array
的用法示例。
在下文中一共展示了V8Array.release方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: execute
import com.eclipsesource.v8.V8Array; //导入方法依赖的package包/类
@Override
public String execute(String dot) {
V8Array parameters = new V8Array(runtime).push(dot);
try {
runtime.executeVoidScript(JSMESSAGESARRAYSPLICE);
return (String) vizFunction.call(runtime, parameters);
} catch (Exception e) {
if (messages.length() > 0) {
// Now something really bad happened: viz.js tells us something
// with printing (e.g. Abort).
String summary = "";
for (int i = 0; i < messages.length(); i++) {
summary += V8ObjectUtils.getValue(messages, i) + "\n";
}
throw new VizJSException(summary, e);
}
throw new VizJSException("Problems executing function viz.js in engine: " + getVersion(), e);
} finally {
parameters.release();
}
}
示例2: jcdemoString
import com.eclipsesource.v8.V8Array; //导入方法依赖的package包/类
private void jcdemoString(V8Array parameters) {
String[] calls = JCDemoString.splitBy(parameters.getString(0), parameters.getInteger(1), '&');
parameters.release();
for (String call: calls) {
jsdemoString.call(call);
}
justView.draw(jsdemoString.getShapeList());
jsdemoString.clearShapeList();
}
示例3: jcdemoJson
import com.eclipsesource.v8.V8Array; //导入方法依赖的package包/类
private void jcdemoJson(V8Array parameters) {
JustCall[] calls = JSON.parseObject(parameters.getString(0), JustCall[].class);
parameters.release();
for (JustCall call: calls) {
jsdemoJson.call(call);
}
justView.draw(jsdemoJson.getShapeList());
jsdemoJson.clearShapeList();
}
示例4: setLineDash
import com.eclipsesource.v8.V8Array; //导入方法依赖的package包/类
public void setLineDash(V8Array intervals) {
float[] floatIntervals = new float[intervals.length()];
for (int i = 0; i < intervals.length(); i++) {
floatIntervals[i] = (float)((double)intervals.getDouble(i));
}
PathEffect effects = new DashPathEffect(floatIntervals, 1);
mPaintStroke.setPathEffect(effects);
intervals.release();
}
示例5: getSanitizedHtml
import com.eclipsesource.v8.V8Array; //导入方法依赖的package包/类
/**
* Parses the supplied markdown into html.
* This calls the PageDown javascript library to do the work for us.
*/
public static String getSanitizedHtml(String markdown){
// System.out.println(new File(".").getAbsolutePath());
// for(String f : new File(".").list()){
// System.out.println("\t" + f);
// }
if(markdown == null){
return null;
}
try{
V8 runtime = V8.createV8Runtime();
runtime.executeScript( new String(Files.readAllBytes(Paths.get(PageDownUtils.class.getResource("Markdown.Converter.js").toURI()))));
runtime.executeScript( new String(Files.readAllBytes(Paths.get(PageDownUtils.class.getResource("Markdown.Sanitizer.js").toURI()))));
runtime.executeScript( new String(Files.readAllBytes(Paths.get(PageDownUtils.class.getResource("MarkdownParser.js").toURI()))));
V8Array args = new V8Array(runtime);
args.push(markdown);
String html = runtime.executeStringFunction("parseMarkdown", args);
args.release();
runtime.release();
return html;
}
catch(Exception e){
e.printStackTrace();
return "ERROR";
}
}
示例6: convert
import com.eclipsesource.v8.V8Array; //导入方法依赖的package包/类
@Override
@SuppressWarnings("unchecked")
public <T> T convert(Object r, Class<T> resultType) {
if (List.class.isAssignableFrom(resultType) && r instanceof V8Array) {
V8Array arr = (V8Array)r;
r = convertArray(arr);
arr.release();
} else if (Map.class.isAssignableFrom(resultType) && r instanceof V8Object) {
V8Object obj = (V8Object)r;
r = convertObject(obj);
obj.release();
}
return (T)r;
}