[英]Convert byte [] to ArrayList<Object>
我有一個使用Object ArrayList獲得的byte []
誰能告訴我如何將我的byte []轉換為Object ArrayList?
像這樣垂涎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();
謝謝!
現在您已經向我們提供了有關您如何以某種方式進行轉換的信息......您需要:
ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(bytes));
try {
@SuppressWarnings("unchecked")
ArrayList<Object> list = (ArrayList<Object>) ois.readObject();
...
} finally {
ois.close();
}
我將在這里找到明顯的答案......
for(byte b : bytearray) {
arraylist.add(new Byte(b));
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.