private byte[] serialize(Serializable data) { ObjectOutputStream oos = null; try { ByteArrayOutputStream baos = new ByteArrayOutputStream(); oos = new ProxyObjectOutputStream(baos); oos.writeObject(data); return baos.toByteArray(); } catch (Exception e) { throw new RuntimeException("Failed to serialize object", e); } finally { if (oos != null) { IOUtils.closeQuietly(oos); } } }
private byte[] serialize(Serializable data) { ObjectOutputStream oos = null; try { ByteArrayOutputStream baos = new ByteArrayOutputStream(); oos = new ProxyObjectOutputStream(baos); oos.writeObject(data); return baos.toByteArray(); } catch (Exception e) { throw new RuntimeException("Failed to serialize object", e); } finally { if (oos != null) { IOUtils.closeQuietly(oos); } } }