| | |
| | | private static Logger log = LogManager.getLogger(ReisUtils.class); |
| | | |
| | | /** |
| | | * 序列化对象 |
| | | * 序列化对象 |
| | | */ |
| | | public static byte[] serialize(Object obj){ |
| | | ObjectOutputStream objectOs = null; |
| | |
| | | objectOs.writeObject(obj); |
| | | bytes = byteArrOs.toByteArray(); |
| | | } catch (Exception e) { |
| | | log.error("序列化对象失败!"); |
| | | log.error("序列化对象失败!"); |
| | | }finally { |
| | | IOUtils.closeQuietly(objectOs); |
| | | IOUtils.closeQuietly(byteArrOs); |
| | |
| | | } |
| | | |
| | | /** |
| | | * 反序列化对象 |
| | | * 反序列化对象 |
| | | */ |
| | | public static Object unserialize(byte[] bytes){ |
| | | Object returnObject = null; |
| | |
| | | returnObject = objectIns.readObject(); |
| | | } |
| | | }catch (Exception e) { |
| | | log.error("反序列化对象失败!",e); |
| | | log.error("反序列化对象失败!",e); |
| | | }finally { |
| | | IOUtils.closeQuietly(objectIns); |
| | | IOUtils.closeQuietly(byteArrIns); |