public static byte[] readFileByBytes(String filePath) throws IOException { File file = new File(filePath); if (!file.exists()) { throw new FileNotFoundException(filePath); } else { ByteArrayOutputStream bos = new ByteArrayOutputStream((int)file.length()); BufferedInputStream in = null; try { in = new BufferedInputStream(new FileInputStream(file)); int bufSize = 1024; byte[] buffer = new byte[bufSize]; boolean var6 = false; int len; while(-1 != (len = in.read(buffer, 0, bufSize))) { bos.write(buffer, 0, len); } byte[] var7 = bos.toByteArray(); return var7; } finally { try { if (in != null) { in.close(); } } catch (IOException var14) { var14.printStackTrace(); } bos.close(); } }
11-27
994
03-27
2096
10-25
419
“相关推荐”对你有帮助么?
-
非常没帮助
-
没帮助
-
一般
-
有帮助
-
非常有帮助
提交