SerializeUtil序列化工具類解析
阿新 • • 發佈:2019-01-30
public static Map<String, Object> testBytes2Map(byte[] bytes) {
Map<String, Object> result = null;
try {
ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(bytes);
ObjectInputStream inputStream = new ObjectInputStream(byteArrayInputStream);
result = (Map<String, Object>) inputStream.readObject();
inputStream.close();
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return result;
}
Map<String, Object> result = null;
try {
ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(bytes);
ObjectInputStream inputStream = new ObjectInputStream(byteArrayInputStream);
result = (Map<String, Object>) inputStream.readObject();
inputStream.close();
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return result;
}