简体   繁体   中英

get Java byte[] from HashMap<String , byte>

I have a

Map nameANDbytes =  new HashMap<String, byte[]>();

How can I get that byte array out of map?

Lets say I put

 InputStream input = zipfile.getInputStream(zipentry);
 BufferedReader br = new BufferedReader(new InputStreamReader(input, "UTF-8"));
 nameANDbytes.put(fileName, br.toString().getBytes());

print is :

*.png
[B@1339e7aa

now I want to get values :

byte[] b = entry.getValue().toString().getBytes();

and it is

[B@1fb669c3

What's wrong?

我想你要

byte[] b = (byte[]) entry.getValue();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM