从HashMap获取Java字节[]<;字符串,字节>;

从HashMap获取Java字节[]<;字符串,字节>;,java,Java,我有一个 Map nameANDbytes = new HashMap<String, byte[]>(); 印刷品是: *.png [B@1339e7aa 现在,我想获取值: byte[] b = entry.getValue().toString().getBytes(); 的确如此 [B@1fb669c3 怎么了?我想你想要 byte[] b = (byte[]) entry.getValue(); 问题出在哪里?虽然您的问题并不完全清楚,但我想说br.toStri

我有一个

Map nameANDbytes =  new HashMap<String, byte[]>();
印刷品是:

*.png
[B@1339e7aa
现在,我想获取值:

byte[] b = entry.getValue().toString().getBytes();
的确如此

[B@1fb669c3
怎么了?

我想你想要

byte[] b = (byte[]) entry.getValue();
问题出在哪里?虽然您的问题并不完全清楚,但我想说
br.toString().getBytes()
是错误的
br.toString()
不读取您的输入。您只需要获取
BufferedReader
的字符串表示形式,然后将该字符串转换为字节数组。完全有效的代码,但可能不是您的目标。
byte[] b = (byte[]) entry.getValue();