private Object fromBytes(byte[] bytes) throws SerializationException { return SerializationHelper.deserialize( bytes, getReturnedClass().getClassLoader() ); }
private static byte[] toBytes(Object object) throws SerializationException { return SerializationHelper.serialize( (Serializable) object ); }
/** * <p>Deep clone an <code>Object</code> using serialization.</p> * * <p>This is many times slower than writing clone methods by hand * on all objects in your object graph. However, for complex object * graphs, or for those that don't support deep cloning this can * be a simple alternative implementation. Of course all the objects * must be <code>Serializable</code>.</p> * * @param object the <code>Serializable</code> object to clone * @return the cloned object * @throws SerializationException (runtime) if the serialization fails */ public static Object clone(Serializable object) throws SerializationException { log.trace("Starting clone through serialization"); return deserialize( serialize(object) ); }
public Serializable disassemble( final Object arg0 ) throws HibernateException { return (Serializable) SerializationHelper.clone( (Serializable) arg0 ); }
/** * <p>Deep clone an <code>Object</code> using serialization.</p> * * <p>This is many times slower than writing clone methods by hand * on all objects in your object graph. However, for complex object * graphs, or for those that don't support deep cloning this can * be a simple alternative implementation. Of course all the objects * must be <code>Serializable</code>.</p> * * @param object the <code>Serializable</code> object to clone * @return the cloned object * @throws SerializationException (runtime) if the serialization fails */ public static Object clone(Serializable object) throws SerializationException { log.trace("Starting clone through serialization"); return deserialize( serialize(object) ); }
public Object assemble( final Serializable arg0, final Object arg1 ) throws HibernateException { return SerializationHelper.clone( arg0 ); }
try { log.info( "Mapping cached file: " + lazyfile ); doc = ( org.dom4j.Document ) SerializationHelper.deserialize( new FileInputStream( lazyfile ) ); try { log.info( "Writing cached file of " + xmlFile + " to " + lazyfile ); SerializationHelper.serialize( ( Serializable ) doc, new FileOutputStream( lazyfile ) );
private static byte[] toBytes(Object object) throws SerializationException { return SerializationHelper.serialize( (Serializable) object ); }
private static Object fromBytes(byte[] bytes) throws SerializationException { return SerializationHelper.deserialize( bytes ); }
public Object deepCopy( final Object arg0 ) throws HibernateException { return SerializationHelper.clone( (Serializable) arg0 ); }
try { log.info( "Reading mappings from cache file: " + cachedFile ); doc = ( org.dom4j.Document ) SerializationHelper.deserialize( new FileInputStream( cachedFile ) ); SerializationHelper.serialize( ( Serializable ) doc, new FileOutputStream( cachedFile ) );
private static byte[] toBytes(Object object) throws SerializationException { return SerializationHelper.serialize( (Serializable) object ); }
private static Object fromBytes( byte[] bytes ) throws SerializationException { return SerializationHelper.deserialize(bytes); }
public Object replace( final Object arg0, final Object arg1, final Object arg2 ) throws HibernateException { return SerializationHelper.clone( (Serializable) arg0 ); }
private static byte[] toBytes(Object object) throws SerializationException { return SerializationHelper.serialize( (Serializable) object ); }
private static Object fromBytes( byte[] bytes ) throws SerializationException { return SerializationHelper.deserialize(bytes); }
/** * <p>Serializes an <code>Object</code> to a byte array for * storage/serialization.</p> * * @param obj the object to serialize to bytes * @return a byte[] with the converted Serializable * @throws SerializationException (runtime) if the serialization fails */ public static byte[] serialize(Serializable obj) throws SerializationException { ByteArrayOutputStream baos = new ByteArrayOutputStream(512); serialize(obj, baos); return baos.toByteArray(); }
/** * <p>Deserializes a single <code>Object</code> from an array of bytes.</p> * * @param objectData the serialized object, must not be null * @return the deserialized object * @throws IllegalArgumentException if <code>objectData</code> is <code>null</code> * @throws SerializationException (runtime) if the serialization fails */ public static Object deserialize(byte[] objectData) throws SerializationException { if (objectData == null) { throw new IllegalArgumentException("The byte[] must not be null"); } ByteArrayInputStream bais = new ByteArrayInputStream(objectData); return deserialize(bais); }
/** * <p>Serializes an <code>Object</code> to a byte array for * storage/serialization.</p> * * @param obj the object to serialize to bytes * @return a byte[] with the converted Serializable * @throws SerializationException (runtime) if the serialization fails */ public static byte[] serialize(Serializable obj) throws SerializationException { ByteArrayOutputStream baos = new ByteArrayOutputStream(512); serialize(obj, baos); return baos.toByteArray(); }
/** * <p>Deserializes a single <code>Object</code> from an array of bytes.</p> * * @param objectData the serialized object, must not be null * @return the deserialized object * @throws IllegalArgumentException if <code>objectData</code> is <code>null</code> * @throws SerializationException (runtime) if the serialization fails */ public static Object deserialize(byte[] objectData) throws SerializationException { if (objectData == null) { throw new IllegalArgumentException("The byte[] must not be null"); } ByteArrayInputStream bais = new ByteArrayInputStream(objectData); return deserialize(bais); }