MCPcopy Create free account
hub / github.com/defineYIDA/LWebServer / getBytesFromFile

Method getBytesFromFile

src/main/java/cn/lws/server/util/IOUtil.java:18–26  ·  view source on GitHub ↗
(String fileName)

Source from the content-addressed store, hash-verified

16public class IOUtil {
17
18 public static byte[] getBytesFromFile(String fileName) throws IOException {
19 URL url = IOUtil.class.getResource(fileName);
20 if (url == null) {
21 log.info("file:{}",fileName);
22 throw new FileNotFoundException();
23 }
24 log.info("正在读取文件:{}",url.getFile());
25 return getBytesFromStream(new FileInputStream(url.getFile()));
26 }
27
28 public static byte[] getBytesFromStream(FileInputStream in) throws IOException {
29 FileChannel channel = in.getChannel();

Callers 4

resolveMethod · 0.95
handleMethod · 0.95
forwardMethod · 0.95
handleMethod · 0.95

Calls 1

getBytesFromStreamMethod · 0.95

Tested by 1

resolveMethod · 0.76