1. 程式人生 > >SerializeUtil序列化工具類解析

SerializeUtil序列化工具類解析

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;
    }