[英]Convert byte [] to ArrayList<Object>
I have a byte [] that i obtained using Object ArrayList 我有一个使用Object ArrayList获得的byte []
Can anyone tell me how to convert my byte [] to Object ArrayList? 谁能告诉我如何将我的byte []转换为Object ArrayList?
coveting arraylist like this 像这样垂涎arraylist
ByteArrayOutputStream bos = new ByteArrayOutputStream(); ObjectOutputStream oos = null; oos = new ObjectOutputStream(bos); oos.writeObject(mArrayList);//mArrayList is the array to convert byte[] buff = bos.toByteArray();
Thank you! 谢谢!
Now you've given us the information about how you did the conversion one way... you need: 现在您已经向我们提供了有关您如何以某种方式进行转换的信息......您需要:
ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(bytes));
try {
@SuppressWarnings("unchecked")
ArrayList<Object> list = (ArrayList<Object>) ois.readObject();
...
} finally {
ois.close();
}
I'm going to go with the obvious answer here... 我将在这里找到明显的答案......
for(byte b : bytearray) {
arraylist.add(new Byte(b));
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.