com.crossoverjie.distributed.util.ScriptUtil Maven / Gradle / Ivy
package com.crossoverjie.distributed.util;
import java.io.*;
/**
* Function:
*
* @author crossoverJie
* Date: 22/04/2018 15:55
* @since JDK 1.8
*/
public class ScriptUtil {
/**
* return lua script String
*
* @param path
* @return
*/
public static String getScript(String path) {
StringBuilder sb = new StringBuilder();
InputStream stream = ScriptUtil.class.getClassLoader().getResourceAsStream(path);
BufferedReader br = new BufferedReader(new InputStreamReader(stream));
try {
String str = "";
while ((str = br.readLine()) != null) {
sb.append(str).append(System.lineSeparator());
}
} catch (IOException e) {
System.err.println(e.getStackTrace());
}
return sb.toString();
}
}