當前位置: 首頁>>代碼示例>>Java>>正文


Java PlatformDependent.copyMemory方法代碼示例

本文整理匯總了Java中io.netty.util.internal.PlatformDependent.copyMemory方法的典型用法代碼示例。如果您正苦於以下問題:Java PlatformDependent.copyMemory方法的具體用法?Java PlatformDependent.copyMemory怎麽用?Java PlatformDependent.copyMemory使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在io.netty.util.internal.PlatformDependent的用法示例。


在下文中一共展示了PlatformDependent.copyMemory方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: setBytes

import io.netty.util.internal.PlatformDependent; //導入方法依賴的package包/類
public ByteBuf setBytes(int index, ByteBuffer src, int srcIndex, int length) {
  if (src.isDirect()) {
    checkIndex(index, length);
    PlatformDependent.copyMemory(PlatformDependent.directBufferAddress(src) + srcIndex, this.memoryAddress() + index,
        length);
  } else {
    if (srcIndex == 0 && src.capacity() == length) {
      b.setBytes(index + offset, src);
    } else {
      ByteBuffer newBuf = src.duplicate();
      newBuf.position(srcIndex);
      newBuf.limit(srcIndex + length);
      b.setBytes(index + offset, src);
    }
  }

  return this;
}
 
開發者ID:skhalifa,項目名稱:QDrill,代碼行數:19,代碼來源:DrillBuf.java

示例2: ensureAvailableBlocks

import io.netty.util.internal.PlatformDependent; //導入方法依賴的package包/類
public void ensureAvailableBlocks(int count){
  if(count > capacity){
    final int blockWidth = this.blockWidth;
    final int sizeInBytes = Numbers.nextPowerOfTwo(count * blockWidth);
    final ArrowBuf oldBuf = buf;
    buf = allocator.buffer(sizeInBytes);

    // since blockWidth has to be a power of two and count
    final long firstBlock = buf.memoryAddress() + (capacity * blockWidth);
    final int maxBytes = blockWidth * count;
    final long maxBlock = buf.memoryAddress() + maxBytes;
    for(long l = firstBlock; l < maxBlock; l+= 8){
      PlatformDependent.putLong(l, 0);
    }

    int remain = maxBytes % 8;
    if(remain != 0){
      buf.setZero(maxBytes - remain, remain);
    }

    PlatformDependent.copyMemory(oldBuf.memoryAddress(), buf.memoryAddress(), capacity * blockWidth);

    oldBuf.release();
    this.capacity = count;
  }
}
 
開發者ID:dremio,項目名稱:dremio-oss,代碼行數:27,代碼來源:FixedBlockVector.java

示例3: ensureAvailableDataSpace

import io.netty.util.internal.PlatformDependent; //導入方法依賴的package包/類
/**
 * Expand the buffer as necessary.
 * @param sizeInBytes
 * @return true if the buffer was expanded (meaning one needs to reread the memory address).
 */
public boolean ensureAvailableDataSpace(int sizeInBytes){
  if(buf.capacity() < sizeInBytes){
    int targetSize = Numbers.nextPowerOfTwo(sizeInBytes);
    final ArrowBuf oldBuf = buf;
    buf = allocator.buffer(targetSize);
    PlatformDependent.copyMemory(oldBuf.memoryAddress(), buf.memoryAddress(), oldBuf.capacity());
    oldBuf.release();
    return true;
  }

  return false;
}
 
開發者ID:dremio,項目名稱:dremio-oss,代碼行數:18,代碼來源:VariableBlockVector.java

示例4: unsafeCopy1MB

import io.netty.util.internal.PlatformDependent; //導入方法依賴的package包/類
public static void unsafeCopy1MB(final long src, final long dst, int len) {
  PlatformDependent.copyMemory(src, dst, len);
}
 
開發者ID:dremio,項目名稱:dremio-oss,代碼行數:4,代碼來源:Copier.java


注:本文中的io.netty.util.internal.PlatformDependent.copyMemory方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。