(转)[Java]文件转二进制
程序员文章站
2022-07-12 16:13:24
...
转自:https://blog.csdn.net/weixin_36022745/article/details/84637515
public static byte[] fileToByte(String filePath) throws IOException{ byte[] bytes = null; FileInputStream fis = null; try{ File file = new File(filepath); fis = new FileInputStream(file); bytes = new bytes[(int) file.length()]; fis.read(bytes); }catch(IOException e){ e.printStackTrace(); throw e; }finally{ fis.close(); } return bytes; }
上一篇: [SQL]多对多查询、删除、修改
下一篇: [Java][前端]如何换行