📅  最后修改于: 2022-03-11 14:52:49.302000             🧑  作者: Mango
public static String loadFileAsString(String path) {
InputStream stream = YourClassName.class.getResourceAsStream(path);
try {
String result = new String(stream.readAllBytes());
return result;
} catch (IOException e) {
e.printStackTrace();
return null;
}
}