【发布时间】:2017-06-01 05:08:30
【问题描述】:
我想读取文件上的所有字节,但是当我这样做时
Path fileLocation = Paths.get("./env.wav");
byte[] data = Files.readAllBytes(fileLocation);
System.out.println(data);
它只输出这个:
[B@6ab1bd82
而不是像这样输出字节数组:
249 4646 ac98 0200 5741 5645 666d 7420 1000 0000 0100 0100 44ac 0000 8858 0100 0200 1000 6461 7461 8898 0200 7900 5200 5600 3b00 3100 0c00 6500 4000 2500 7a00 2d00 0c00 5400 5100 2500 1200 feff 0d00 [等等............]
【问题讨论】:
-
使用
Arrays.toString(data);... -
你想要实现的是将字节数组转换为十六进制字符串,看看this answer
标签: java