public bytes[] getBytesFromFile(File cntIdImg){
FileInputStream is = new FileInputStream(cntIdImg);
long length = cntIdImg.length();
byte[] idImgBytes = new byte[(int)length];
is.read(idImgBytes);
is.close();
return idImgBytes;
}
有待改善
本文介绍了一个将文件内容读取为字节数组的方法,包括初始化文件输入流、获取文件长度、创建字节数组、读取文件内容并关闭输入流的步骤。
7645

被折叠的 条评论
为什么被折叠?



