[英]How to read binary file in to a 100 bytes length array
I want to read a binary file in to a byte array, not in to a single byte array but in to a 100 bytes length array, maybe with a loop... 我想读取一个二进制文件到一个字节数组,而不是一个单字节数组,而是一个100字节长的数组,可能有一个循环......
public void readBinaryFile()
{
byte data[] = null;
try {
Path path1 = Paths.get("image.jpg");
data = Files.readAllBytes(path1);
} catch (Exception e) {
System.out.println("file reading error!!!");
}
System.out.println("img length: "+data.length);
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.