Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ```java
- // 读取路径
- File file = new File(KeyWordExtract.class.getResource("/").getPath() + classpath);
- if (file.exists()) {
- return Files.readAllLines(file.toPath());
- }
- // 高效的类加载器方式获取文件
- InputStream in = Thread.currentThread().getContextClassLoader().getResourceAsStream(classpath);
- BufferedReader buffer = new BufferedReader(new InputStreamReader(in));
- return buffer.lines().collect(Collectors.toList());
- ```
Add Comment
Please, Sign In to add comment