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.
34 lines
753 B
34 lines
753 B
package com.fr.plugin.db.redis.help; |
|
|
|
import com.eclipsesource.v8.V8; |
|
import com.fanruan.api.util.IOKit; |
|
import com.fanruan.api.consts.EncodeConstantsKit; |
|
|
|
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, EncodeConstantsKit.ENCODING_UTF_8)); |
|
} catch (UnsupportedEncodingException ignore) { |
|
|
|
} |
|
} |
|
} |
|
}
|
|
|