private static byte[] toBytes(Object object) throws SerializationException { return SerializationHelper.serialize( (Serializable) object ); }
private static byte[] toBytes(Object object) throws SerializationException { return SerializationHelper.serialize( (Serializable) object ); }
private static byte[] toBytes(Object object) throws SerializationException { return SerializationHelper.serialize( (Serializable) object ); }
private static byte[] toBytes(Object object) throws SerializationException { return SerializationHelper.serialize( (Serializable) object ); }
/** * <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>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>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) ); }
/** * <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) ); }
try { log.info( "Writing cached file of " + xmlFile + " to " + lazyfile ); SerializationHelper.serialize( ( Serializable ) doc, new FileOutputStream( lazyfile ) );
public void nullSafeSet( final PreparedStatement arg0, final Object arg1, final int arg2 ) throws HibernateException, SQLException { if ( BlobUserType.debug ) { BlobUserType.log.debug( Messages.getInstance().getString( "BLOBUTYPE.DEBUG_NULL_SAFE_SET" ) ); //$NON-NLS-1$ } if ( arg1 != null ) { try { arg0.setBytes( arg2, SerializationHelper.serialize( (Serializable) arg1 ) ); } catch ( SerializationException ex ) { BlobUserType.log.error( Messages.getInstance().getErrorString( "BLOBUTYPE.ERROR_0001_SETTING_BLOB" ), ex ); //$NON-NLS-1$ throw new HibernateException( Messages.getInstance().getErrorString( "BLOBUTYPE.ERROR_0001_SETTING_BLOB" ), ex ); //$NON-NLS-1$ } } else { arg0.setNull( arg2, sqlTypes()[0] ); } }
SerializationHelper.serialize( ( Serializable ) doc, new FileOutputStream( cachedFile ) );