读取jar包中的资源文件为流

InputStream resourceAsStream = this.getClass().getResourceAsStream(“/templates/index.ftl”);
BufferedReader br = new BufferedReader(new InputStreamReader(resourceAsStream));
String s=””;
while((s = br.readLine()) != null)
System.out.println(s);

发表评论

邮箱地址不会被公开。 必填项已用*标注