把Map转换成byte数组,使用 ByteArrayOutputStream 和 ObjectOutputStream

ByteArrayOutputStream stream = new ByteArrayOutputStream()

bmp.compress(Bitmap.CompressFormat.PNG, 100, stream)

byte[] byteArray = stream.toByteArray()

public static byte[] getSerializedBytes(Map<String, Double> list) {undefined

if (null == list || list.size() < 0)

return null

try {undefined

ByteArrayOutputStream bo = new ByteArrayOutputStream()

ObjectOutputStream os = new ObjectOutputStream(bo)

os.writeObject(list)

return bo.toByteArray()

} catch (IOException e) {undefined

return null