tkalkirill commented on a change in pull request #697:
URL: https://github.com/apache/ignite-3/pull/697#discussion_r837724292



##########
File path: 
modules/page-memory/src/main/java/org/apache/ignite/internal/pagememory/util/PageUtils.java
##########
@@ -279,4 +279,27 @@ public static void copyMemory(ByteBuffer src, long srcOff, 
ByteBuffer dst, long
     public static void copyMemory(long srcAddr, long srcOff, long dstAddr, 
long dstOff, long cnt) {
         GridUnsafe.copyMemory(null, srcAddr + srcOff, null, dstAddr + dstOff, 
cnt);
     }
+
+    /**
+     * Writes a {@link ByteBuffer} into the memory.
+     *
+     * @param addr Address.
+     * @param off Offset.
+     * @param buf Byte buffer.
+     */
+    public static void putByteBuffer(long addr, int off, ByteBuffer buf) {
+        assert addr > 0 : addr;
+        assert off >= 0 : off;
+        assert buf != null;
+
+        if (buf.isDirect()) {
+            GridUnsafe.copyMemory(buf, GridUnsafe.bufferAddress(buf), null, 
addr + off, buf.limit());

Review comment:
       Corrected and added tests:
   - PageIdUtilsTest#testPutByteBufferIndirect
   - PageIdUtilsTest#testPutByteBufferDirect




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to