List of utility methods to do Object Deep Clone
E | deepClone(final E object) deep Clone final E deepCopy = (E) doCopy(object); return deepCopy; |
T | deepClone(final T objectToBeClonned) deep Clone if (objectToBeClonned == null) { return null; ObjectOutputStream oos = null; ObjectInputStream ois = null; try { final ByteArrayOutputStream bos = new ByteArrayOutputStream(); oos = new ObjectOutputStream(bos); ... |
Object | deepClone(Object obj) deep Clone ObjectOutputStream oos = null; ObjectInputStream ois = null; try { ByteArrayOutputStream bos = new ByteArrayOutputStream(); oos = new ObjectOutputStream(bos); oos.writeObject(obj); oos.flush(); ByteArrayInputStream bin = new ByteArrayInputStream(bos.toByteArray()); ... |
Object | deepClone(Object objToClone) deep Clone try { ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(baos); oos.writeObject(objToClone); ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray()); ObjectInputStream ois = new ObjectInputStream(bais); Object deepCopy = ois.readObject(); return deepCopy; ... |
Object | deepClone(Object src) deep Clone try { ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(baos); oos.writeObject(src); ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray()); ObjectInputStream ois = new ObjectInputStream(bais); return ois.readObject(); } catch (Exception e) { ... |
Object | deepClone(Object src) deep Clone ByteArrayOutputStream betyArrayOutputStream = new ByteArrayOutputStream(); ObjectOutputStream objectOutputStream = new ObjectOutputStream(betyArrayOutputStream); objectOutputStream.writeObject(src); ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(betyArrayOutputStream.toByteArray()); ObjectInputStream objInputStream = new ObjectInputStream(byteArrayInputStream); return objInputStream.readObject(); |
Object | deepClone(Serializable o) deep Clone return deserialize(serialize(o));
|
Serializable | deepClone(Serializable serializable) deep Clone ByteArrayOutputStream arrayOutputStream = new ByteArrayOutputStream(); new ObjectOutputStream(arrayOutputStream).writeObject(serializable); ByteArrayInputStream bais = new ByteArrayInputStream(arrayOutputStream.toByteArray()); return (Serializable) new ObjectInputStream(bais).readObject(); |
T | deepClone(T toClone, final ClassLoader classLoader) Creates a clone of any serializable object. if (null == toClone) return null; ByteArrayOutputStream bOut = new ByteArrayOutputStream(); ObjectOutputStream oOut = new ObjectOutputStream(bOut); oOut.writeObject(toClone); oOut.close(); ByteArrayInputStream bIn = new ByteArrayInputStream(bOut.toByteArray()); bOut.close(); ... |
Object | deepCloneObj(Object src) deep Clone Obj Object o = null; try { if (src != null) { ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(baos); oos.writeObject(src); oos.close(); ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray()); ... |