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.
35 lines
768 B
35 lines
768 B
6 years ago
|
package com.fr.plugin.db.redis.help;
|
||
|
|
||
|
import com.eclipsesource.v8.V8;
|
||
|
import com.fr.general.IOUtils;
|
||
|
import com.fr.io.utils.ResourceIOUtils;
|
||
|
import com.fr.stable.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;
|
||
|
}
|
||
|
|
||
|
public void require(String filePath) {
|
||
|
InputStream in = ResourceIOUtils.read(filePath);
|
||
|
if (in != null) {
|
||
|
try {
|
||
|
v8.executeVoidScript(IOUtils.inputStream2String(in, EncodeConstants.ENCODING_UTF_8));
|
||
|
} catch (UnsupportedEncodingException ignore) {
|
||
|
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|