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.
|
|
|
package com.fr.plugin.db.redis.help;
|
|
|
|
|
|
|
|
import com.eclipsesource.v8.V8;
|
|
|
|
import com.fanruan.api.util.IOKit;
|
|
|
|
import com.fanruan.api.macro.EncodeConstants;
|
|
|
|
|
|
|
|
import java.io.InputStream;
|
|
|
|
import java.io.UnsupportedEncodingException;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @author richie
|
|
|
|
* @version 10.0
|
|
|
|
* Created by richie on 2019-03-19
|
|
|
|
*/
|
|
|
|
public class Files {
|
|
|
|
|
|
|
|
private V8 v8;
|
|
|
|
|
|
|
|
public Files(V8 v8) {
|
|
|
|
this.v8 = v8;
|
|
|
|
}
|
|
|
|
|
|
|
|
@ScriptBridge
|
|
|
|
public void require(String filePath) {
|
|
|
|
InputStream in = IOKit.read(filePath);
|
|
|
|
if (in != null) {
|
|
|
|
try {
|
|
|
|
v8.executeVoidScript(IOKit.inputStream2String(in, EncodeConstants.ENCODING_UTF_8));
|
|
|
|
} catch (UnsupportedEncodingException ignore) {
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|