我用这个话题:File to byte[] in Java 这里是我的代码:文件到字节数组
try {
Path path1 = Paths.get(path + fileName);
byte[] fileAsByte = Files.readAllBytes(path1);
System.out.println("Byte : " + fileAsByte.toString());
} catch (FileNotFoundException e) {
System.out.println("File Not Found.");
e.printStackTrace();
} catch (IOException e1) {
System.out.println("Error Reading The File.");
e1.printStackTrace();
} catch (OutOfMemoryError e3) {
System.out.println("Out of Memory");
e3.printStackTrace();
}
此代码不会触发任何异常,但产量仍:
Byte : [[email protected]
这对我来说似乎非常无效。我很确定我做了一个愚蠢的错误,但我一直试图解决这个问题已经三个小时了,我可以用一些新的眼光来解决它。
谢谢。