forked from fanruan/demo-tabledata-redis
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
806 B
36 lines
806 B
5 years ago
|
package com.fr.plugin.db.redis.help.client;
|
||
5 years ago
|
|
||
|
import com.eclipsesource.v8.V8;
|
||
5 years ago
|
import com.fanruan.api.macro.EncodeConstants;
|
||
5 years ago
|
import com.fanruan.api.util.IOKit;
|
||
5 years ago
|
import com.fr.plugin.db.redis.help.ScriptBridge;
|
||
5 years ago
|
|
||
|
import java.io.InputStream;
|
||
|
import java.io.UnsupportedEncodingException;
|
||
|
|
||
|
/**
|
||
|
* @author richie
|
||
|
* @version 10.0
|
||
|
* Created by richie on 2019-03-19
|
||
|
*/
|
||
5 years ago
|
public class V8Files {
|
||
5 years ago
|
|
||
|
private V8 v8;
|
||
|
|
||
5 years ago
|
public V8Files(V8 v8) {
|
||
5 years ago
|
this.v8 = v8;
|
||
|
}
|
||
|
|
||
5 years ago
|
@ScriptBridge
|
||
5 years ago
|
public void require(String filePath) {
|
||
5 years ago
|
InputStream in = IOKit.read(filePath);
|
||
5 years ago
|
if (in != null) {
|
||
|
try {
|
||
5 years ago
|
v8.executeVoidScript(IOKit.inputStream2String(in, EncodeConstants.ENCODING_UTF_8));
|
||
5 years ago
|
} catch (UnsupportedEncodingException ignore) {
|
||
|
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|