/** * Constructor. * * @param obj Object. * @param valCtx Object value context. */ public GridH2ValueCacheObject(CacheObject obj, CacheObjectValueContext valCtx) { assert obj != null; if (obj instanceof BinaryObjectImpl) { ((BinaryObjectImpl)obj).detachAllowed(true); obj = ((BinaryObjectImpl)obj).detach(); } this.obj = obj; this.valCtx = valCtx; }
((BinaryObjectImpl)obj0).detachAllowed(true);
/** * @return Value. */ public static BinaryObject doReadBinaryObject(BinaryInputStream in, BinaryContext ctx, boolean detach) { if (in.offheapPointer() > 0) { int len = in.readInt(); int pos = in.position(); in.position(in.position() + len); int start = in.readInt(); return new BinaryObjectOffheapImpl(ctx, in.offheapPointer() + pos, start, len); } else { byte[] arr = doReadByteArray(in); int start = in.readInt(); BinaryObjectImpl binO = new BinaryObjectImpl(ctx, arr, start); if (detach) { binO.detachAllowed(true); return binO.detach(); } return binO; } }
/** * Constructor. * * @param obj Object. * @param valCtx Object value context. */ public GridH2ValueCacheObject(CacheObject obj, CacheObjectValueContext valCtx) { assert obj != null; if (obj instanceof BinaryObjectImpl) { ((BinaryObjectImpl)obj).detachAllowed(true); obj = ((BinaryObjectImpl)obj).detach(); } this.obj = obj; this.valCtx = valCtx; }
((BinaryObjectImpl)obj0).detachAllowed(true);
/** * @return Value. */ public static BinaryObject doReadBinaryObject(BinaryInputStream in, BinaryContext ctx, boolean detach) { if (in.offheapPointer() > 0) { int len = in.readInt(); int pos = in.position(); in.position(in.position() + len); int start = in.readInt(); return new BinaryObjectOffheapImpl(ctx, in.offheapPointer() + pos, start, len); } else { byte[] arr = doReadByteArray(in); int start = in.readInt(); BinaryObjectImpl binO = new BinaryObjectImpl(ctx, arr, start); if (detach) { binO.detachAllowed(true); return binO.detach(); } return binO; } }