当前位置:婀娜女性网>美好生活>心理>

map如何转成byte数组

心理 阅读(1.35W)
map如何转成byte数组

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

ByteArrayOutputStream stream = new ByteArrayOutputStream()

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

byte[] byteArray = teArray()

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

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

return null

try {undefined

ByteArrayOutputStream bo = new ByteArrayOutputStream()

ObjectOutputStream os = new ObjectOutputStream(bo)

eObject(list)

return teArray()

} catch (IOException e) {undefined

return null