文件转换为字节数组
来源:互联网 发布:jquery定义一个数组 编辑:程序博客网 时间:2024/04/30 07:32
/**
* 文件转化为字节数组
*
* @param file
* @return
*/
public static byte[] getBytesFromFile(File file) {
byte[] ret = null;
try {
if (file == null) {
log.error("helper:the file is null!");
return null;
}
FileInputStream in = new FileInputStream(file);
ByteArrayOutputStream out = new ByteArrayOutputStream(4096);
byte[] b = new byte[4096];
int n;
while ((n = in.read(b)) != -1) {
out.write(b, 0, n);
}
in.close();
out.close();
ret = out.toByteArray();
} catch (IOException e) {
log.error("helper:get bytes from file process error!");
e.printStackTrace();
}
return ret;
}
- 文件转换为字节数组
- 字节数组转换为字符串
- 字符串转换为字符串数组和字节数组,字符串数组转换为字节数组
- Algorithm: 字符串转换为 unicode 字节数组
- Algorithm: 字符串转换为 unicode 字节数组
- java对象转换为字节数组
- java对象转换为字节数组
- 输入流 转换为字节数组
- java中二进制转换为字节数组
- java对象转换为字节数组
- java中字节数组转换为字符串
- android 将图片内容解析成字节数组,将字节数组转换为ImageView可调用的Bitmap对象,图片缩放,把字节数组保存为一个文件,把Bitmap转Byte
- android 将图片内容解析成字节数组,将字节数组转换为ImageView可调用的Bitmap对象,图片缩放,把字节数组保存为一个文件,把Bitmap转Byte
- android 将图片内容解析成字节数组,将字节数组转换为ImageView可调用的Bitmap对象,图片缩放,把字节数组保存为一个文件,把Bitmap转Byte
- android 将图片内容解析成字节数组,将字节数组转换为ImageView可调用的Bitmap对象,图片缩放,把字节数组保存为一个文件,把Bitmap转Byte
- android 将图片内容解析成字节数组,将字节数组转换为ImageView可调用的Bitmap对象,图片缩放,把字节数组保存为一个文件,把Bitmap转Byt
- android 将图片内容解析成字节数组,将字节数组转换为ImageView可调用的Bitmap对象,图片缩放,把字节数组保存为一个文件,把Bitmap转Byte
- android 将图片内容解析成字节数组,将字节数组转换为ImageView可调用的Bitmap对象,图片缩放,把字节数组保存为一个文件,把Bitmap转Byte
- 英语人名的含义(转)
- 菜鸟初学H.264--VC6下调试T264编解码器全过程
- xml的应用场合
- ArrayList Vector LinkedList 区别与用法 [转]
- 实现自己的ASP.NET宿主系统
- 文件转换为字节数组
- DBCP配置
- [原创]从IO看数据库底层实现原理
- linux-2.6.14内核移植
- Tomcat5.5 配置 blazeds
- davz教你如何搭建MySql集群
- [组图]办公室的女同事竟然这么睡午觉!不服不行
- cocoa-awakeFromNib
- J2ME FileConnector相关 暂不理解