/** * @param obj Object to wrap. */ public BinaryObjectBuilderImpl(BinaryObjectImpl obj) { this(new BinaryBuilderReader(obj), obj.start()); reader.registerObject(this); }
/** * Constructor. * * @param objImpl Binary object */ BinaryBuilderReader(BinaryObjectImpl objImpl) { ctx = objImpl.context(); arr = objImpl.array(); pos = objImpl.start(); reader = new BinaryReaderExImpl(ctx, BinaryHeapInputStream.create(arr, pos), ctx.configuration().getClassLoader(), false); objMap = new HashMap<>(); }
/** * @param po Binary object. */ public void doWriteBinaryObject(@Nullable BinaryObjectImpl po) { if (po == null) out.writeByte(GridBinaryMarshaller.NULL); else { byte[] poArr = po.array(); out.unsafeEnsure(1 + 4 + poArr.length + 4); out.unsafeWriteByte(GridBinaryMarshaller.BINARY_OBJ); out.unsafeWriteInt(poArr.length); out.writeByteArray(poArr); out.unsafeWriteInt(po.start()); } }
/** * @param obj Object to wrap. */ public BinaryObjectBuilderImpl(BinaryObjectImpl obj) { this(new BinaryBuilderReader(obj), obj.start()); reader.registerObject(this); }
/** * Constructor. * * @param objImpl Binary object */ BinaryBuilderReader(BinaryObjectImpl objImpl) { ctx = objImpl.context(); arr = objImpl.array(); pos = objImpl.start(); reader = new BinaryReaderExImpl(ctx, BinaryHeapInputStream.create(arr, pos), ctx.configuration().getClassLoader(), false); objMap = new HashMap<>(); }
/** * @param po Binary object. */ public void doWriteBinaryObject(@Nullable BinaryObjectImpl po) { if (po == null) out.writeByte(GridBinaryMarshaller.NULL); else { byte[] poArr = po.array(); out.unsafeEnsure(1 + 4 + poArr.length + 4); out.unsafeWriteByte(GridBinaryMarshaller.BINARY_OBJ); out.unsafeWriteInt(poArr.length); out.writeByteArray(poArr); out.unsafeWriteInt(po.start()); } }