标签:SHA256 invoke jsf UNC code manage ble 调用 一个
Java中自带库函数中有ScriptEngine可以支持javascript等script文件
ScriptEngineManager manager = new ScriptEngineManager();
//ScriptEngine可以理解为一个工厂,根据你输入的语言名字,返回调用的函数库。
ScriptEngine jsEngine = manager.getEngineByName("javascript");
String jsFileName = "sha256.js";
FileReader reader = new FileReader(jsFileName);
//通过eval函数
jsEngine.eval(reader);
String str = null;
if (jsEngine instanceof Invocable) {
Invocable invoke = (Invocable) jsEngine;
//SHA256是js中的function名字。
str = (String) invoke.invokeFunction("SHA256", toSha);
}
reader.close();
return str;
}
标签:SHA256 invoke jsf UNC code manage ble 调用 一个
原文地址:https://www.cnblogs.com/Jarris/p/9782371.html