JAVA 把File文件转换成Byte[]数组的标准写法
来源:互联网 发布:淘宝商城加入注意什么 编辑:程序博客网 时间:2024/06/12 20:37
public static byte[] getBytesFromFile(File file) throws IOException { InputStream is = new FileInputStream(file); long length = file.length(); if (length > Integer.MAX_VALUE) { // File is too large } byte[] bytes = new byte[(int)length]; int offset = 0; int numRead = 0; while (offset < bytes.length && (numRead=is.read(bytes, offset, bytes.length-offset)) >= 0) { offset += numRead; } if (offset < bytes.length) { throw new IOException("Could not completely read file "+file.getName()); } is.close(); return bytes;}
- JAVA 把File文件转换成Byte[]数组的标准写法
- 使用JAVA将File文件转换为byte[]数组
- java File和Byte[]数组 相互转换
- java的byte数组的不同写法
- java的byte数组的不同写法
- java 文件操作之byte数组间的转换
- java 文件和byte数组相互转换
- Java 文件和byte数组转换
- Java 文件和byte数组转换
- Java 文件和byte数组转换
- Java 文件和byte数组转换
- Java 文件和byte数组转换
- Java 文件和byte数组转换
- java :文件和byte数组转换
- 把String转换成byte数组,在转换成String
- 文件转换成byte[]数组 / byte[]生成文件
- byte数组与文件的转换
- Java byte数组到long的转换
- Email自动完成控件
- cvs server: sticky tag `xxx’ for file ‘xxx’ is not a branch…
- 微软一站式示例代码库(中文版)2011-11-02版本, 新添加ASP.NET, Windows Base, GDI+, Program Language等20个Sample
- 编程修养
- (5)继承
- JAVA 把File文件转换成Byte[]数组的标准写法
- 人民币大写转化函数(C#版)
- MySQL配置方案
- 为什么非得要走冯诺依曼路线
- 探索 Python,第 1 部分: Python 的内置数值类型
- ASp.NET MD5加密
- openrtsp 当成tcpmp插件时内存管理
- 基于JMF RTP的网络传输媒体流
- HTTP协议详解