/** * Register a modified byte array in the current transaction. * * @param buf the byte array to store. * @param dirName the directory name of the object. * @param name the name of the object. * @param copy the byte array can be modified, copy it. * @param first the object is a new one. * * @see fr.dyade.aaa.util.Transaction#saveByteArray(byte[], java.lang.String, java.lang.String, boolean, boolean) */ public final void saveByteArray(byte[] buf, String dirName, String name, boolean copy, boolean first) throws IOException { saveInLog(buf, dirName, name, ((Context) perThreadContext.get()).log, copy, first); }
/** * Register a modified byte array in the current transaction. * * @param buf the byte array to store. * @param dirName the directory name of the object. * @param name the name of the object. * @param copy the byte array can be modified, copy it. * @param first the object is a new one. * * @see fr.dyade.aaa.util.Transaction#saveByteArray(byte[], java.lang.String, java.lang.String, boolean, boolean) */ public final void saveByteArray(byte[] buf, String dirName, String name, boolean copy, boolean first) throws IOException { saveInLog(buf, dirName, name, perThreadContext.get().log, copy, first); }
/** * Register the state of an object in the current transaction. * * @param obj the object to store. * @param dirName the directory name of the object. * @param name the name of the object. * @param first the object is a new one. * * @see fr.dyade.aaa.util.Transaction#save(java.io.Serializable, java.lang.String, java.lang.String, boolean) */ public final void save(Serializable obj, String dirName, String name, boolean first) throws IOException { Context ctx = (Context) perThreadContext.get(); if (ctx.oos == null) { ctx.bos.reset(); ctx.oos = new ObjectOutputStream(ctx.bos); } else { ctx.oos.reset(); ctx.bos.reset(); ctx.bos.write(OOS_STREAM_HEADER, 0, 4); } ctx.oos.writeObject(obj); ctx.oos.flush(); saveInLog(ctx.bos.toByteArray(), dirName, name, ctx.log, false, first); }
saveInLog(encodedObject, dirName, name, ctx.log, false, first);