当前位置: 首页>>代码示例>>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;未经允许,请勿转载。