当前位置: 首页>>代码示例>>Java>>正文


Java PlatformDependent.putShort方法代码示例

本文整理汇总了Java中io.netty.util.internal.PlatformDependent.putShort方法的典型用法代码示例。如果您正苦于以下问题:Java PlatformDependent.putShort方法的具体用法?Java PlatformDependent.putShort怎么用?Java PlatformDependent.putShort使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在io.netty.util.internal.PlatformDependent的用法示例。


在下文中一共展示了PlatformDependent.putShort方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: writeShort

import io.netty.util.internal.PlatformDependent; //导入方法依赖的package包/类
@Override
public ByteBuf writeShort(int value) {
  ensure(2);
  PlatformDependent.putShort(addr(writerIndex), (short) value);
  writerIndex += 2;
  return this;
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:8,代码来源:DrillBuf.java

示例2: writeChar

import io.netty.util.internal.PlatformDependent; //导入方法依赖的package包/类
@Override
public ByteBuf writeChar(int value) {
  ensure(2);
  PlatformDependent.putShort(addr(writerIndex), (short) value);
  writerIndex += 2;
  return this;
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:8,代码来源:DrillBuf.java

示例3: intRoundtrip

import io.netty.util.internal.PlatformDependent; //导入方法依赖的package包/类
@Test
public void intRoundtrip(){
  final int count = 1024;
  try(
      NullableIntVector in = new NullableIntVector("in", allocator);
      NullableIntVector out = new NullableIntVector("out", allocator);
      ){

    in.allocateNew(count);

    for(int i = 0; i < count; i++){
      if(i % 5 == 0){
        in.getMutator().setSafe(i, i);
      }
    }
    in.getMutator().setValueCount(count);

    List<FieldBufferCopier> copiers = FieldBufferCopier.getCopiers(ImmutableList.<FieldVector>of(in), ImmutableList.<FieldVector>of(out));
    try(
        final SelectionVector2 sv2 = new SelectionVector2(allocator);
        ){

      sv2.allocateNew(count);
      // create full sv2.
      int x = 0;
      for(long mem = sv2.memoryAddress(); mem < sv2.memoryAddress() + count * 2; mem+=2){
        PlatformDependent.putShort(mem, (short) (char) x);
        x++;
      }
      sv2.setRecordCount(count);
      copy(copiers, sv2);

      out.getMutator().setValueCount(count);
      for(int i =0; i < count; i++){
        assertEquals(in.getAccessor().getObject(i), out.getAccessor().getObject(i));
      }
    }
  }
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:40,代码来源:TestCopierRoundTrip.java

示例4: bigintRoundtrip

import io.netty.util.internal.PlatformDependent; //导入方法依赖的package包/类
@Test
public void bigintRoundtrip(){
  final int count = 1024;
  try(
      NullableBigIntVector in = new NullableBigIntVector("in", allocator);
      NullableBigIntVector out = new NullableBigIntVector("out", allocator);
      ){

    in.allocateNew(count);

    for(int i = 0; i < count; i++){
      if(i % 5 == 0){
        in.getMutator().setSafe(i, i);
      }
    }
    in.getMutator().setValueCount(count);

    List<FieldBufferCopier> copiers = FieldBufferCopier.getCopiers(ImmutableList.<FieldVector>of(in), ImmutableList.<FieldVector>of(out));
    try(
        final SelectionVector2 sv2 = new SelectionVector2(allocator);
        ){

      sv2.allocateNew(count);
      // create full sv2.
      int x = 0;
      for(long mem = sv2.memoryAddress(); mem < sv2.memoryAddress() + count * 2; mem+=2){
        PlatformDependent.putShort(mem, (short) (char) x);
        x++;
      }
      sv2.setRecordCount(count);
      copy(copiers, sv2);

      out.getMutator().setValueCount(count);
      for(int i =0; i < count; i++){
        assertEquals(in.getAccessor().getObject(i), out.getAccessor().getObject(i));
      }
    }
  }
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:40,代码来源:TestCopierRoundTrip.java

示例5: setShort

import io.netty.util.internal.PlatformDependent; //导入方法依赖的package包/类
@Override
public ByteBuf setShort(int index, int value) {
  chk(index, 2);
  PlatformDependent.putShort(addr(index), (short) value);
  return this;
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:7,代码来源:DrillBuf.java

示例6: setChar

import io.netty.util.internal.PlatformDependent; //导入方法依赖的package包/类
@Override
public ByteBuf setChar(int index, int value) {
  chk(index, 2);
  PlatformDependent.putShort(addr(index), (short) value);
  return this;
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:7,代码来源:DrillBuf.java

示例7: _setShort

import io.netty.util.internal.PlatformDependent; //导入方法依赖的package包/类
private void _setShort(int index, int value) {
    PlatformDependent.putShort(addr(index), (short) value);
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:4,代码来源:UnsafeDirectLittleEndian.java

示例8: projectBuildNonMatches

import io.netty.util.internal.PlatformDependent; //导入方法依赖的package包/类
/**
 * Project any remaining build items that were not matched. Only used when doing a FULL or RIGHT join.
 * @return Negative output if records were output but batch wasn't completed. Positive output if batch was completed.
 */
public int projectBuildNonMatches() {
  assert projectUnmatchedBuild;
  projectBuildNonMatchesWatch.start();

  final int targetRecordsPerBatch = this.targetRecordsPerBatch;

  int outputRecords = 0;
  int remainderBuildSetIndex = this.remainderBuildSetIndex;
  int nextClearIndex = remainderBuildElementIndex;

  BitSet currentBitset = remainderBuildSetIndex < 0 ? null : matches[remainderBuildSetIndex];

  final long projectBuildOffsetAddr = this.projectBuildOffsetAddr;
  // determine the next set of unmatched bits.
  while(outputRecords < targetRecordsPerBatch) {
    if(nextClearIndex == -1){
      // we need to move to the next bit set since the current one has no more matches.
      remainderBuildSetIndex++;
      if (remainderBuildSetIndex < matches.length) {

        currentBitset = matches[remainderBuildSetIndex];
        nextClearIndex = 0;
      } else {
        // no bitsets left.
        this.remainderBuildSetIndex = matches.length;
        remainderBuildSetIndex = -1;
        break;
      }
    }

    nextClearIndex = currentBitset.nextClearBit(nextClearIndex);
    if(nextClearIndex != -1){
      // the clear bit is only valid if it is within the batch it corresponds to.
      if(nextClearIndex >= matchMaxes[remainderBuildSetIndex]){
        nextClearIndex = -1;
      }else{
        final long projectBuildOffsetAddrStart = projectBuildOffsetAddr + outputRecords * BUILD_RECORD_LINK_SIZE;
        PlatformDependent.putInt(projectBuildOffsetAddrStart, remainderBuildSetIndex);
        PlatformDependent.putShort(projectBuildOffsetAddrStart + 4, (short)(nextClearIndex & HashTable.BATCH_MASK));
        outputRecords++;
        nextClearIndex++;
      }
    }
  }

  projectBuildNonMatchesWatch.stop();

  allocateOnlyProbe(outputRecords);
  projectBuild(projectBuildOffsetAddr, outputRecords);

  this.remainderBuildSetIndex = remainderBuildSetIndex;
  this.remainderBuildElementIndex = nextClearIndex;
  if(remainderBuildElementIndex == -1){
    return outputRecords;
  } else {
    return -outputRecords;
  }
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:63,代码来源:VectorizedProbe.java

示例9: setLinks

import io.netty.util.internal.PlatformDependent; //导入方法依赖的package包/类
private void setLinks(long indexAddr, final int buildBatch, final int records){
  for(int incomingRecordIndex = 0; incomingRecordIndex < records; incomingRecordIndex++, indexAddr+=4){

    final int hashTableIndex = PlatformDependent.getInt(indexAddr);

    if(hashTableIndex == -1){
      continue;
    }
    /* Use the global index returned by the hash table, to store
     * the current record index and batch index. This will be used
     * later when we probe and find a match.
     */


    /* set the current record batch index and the index
     * within the batch at the specified keyIndex. The keyIndex
     * denotes the global index where the key for this record is
     * stored in the hash table
     */
    int hashTableBatch  = hashTableIndex >>> 16;
    int hashTableOffset = hashTableIndex & BATCH_MASK;

    final ArrowBuf startIndex = startIndices.get(hashTableBatch);
    final long startIndexMemStart = startIndex.memoryAddress() + hashTableOffset * HashTable.BUILD_RECORD_LINK_SIZE;

    // If head of the list is empty, insert current index at this position
    final int linkBatch = PlatformDependent.getInt(startIndexMemStart);
    if (linkBatch == INDEX_EMPTY) {
      PlatformDependent.putInt(startIndexMemStart, buildBatch);
      PlatformDependent.putShort(startIndexMemStart + 4, (short) incomingRecordIndex);
    } else {
      /* Head of this list is not empty, if the first link
       * is empty insert there
       */
      hashTableBatch = linkBatch;
      hashTableOffset = PlatformDependent.getShort(startIndexMemStart + 4);

      final ArrowBuf firstLink = buildInfoList.get(hashTableBatch).getLinks();
      final long firstLinkMemStart = firstLink.memoryAddress() + hashTableOffset * HashTable.BUILD_RECORD_LINK_SIZE;

      final int firstLinkBatch = PlatformDependent.getInt(firstLinkMemStart);

      if (firstLinkBatch == INDEX_EMPTY) {
        PlatformDependent.putInt(firstLinkMemStart, buildBatch);
        PlatformDependent.putShort(firstLinkMemStart + 4, (short) incomingRecordIndex);
      } else {
        /* Insert the current value as the first link and
         * make the current first link as its next
         */
        final short firstLinkOffset = PlatformDependent.getShort(firstLinkMemStart + 4);

        final ArrowBuf nextLink = buildInfoList.get(buildBatch).getLinks();
        final long nextLinkMemStart = nextLink.memoryAddress() + incomingRecordIndex * HashTable.BUILD_RECORD_LINK_SIZE;

        PlatformDependent.putInt(nextLinkMemStart, firstLinkBatch);
        PlatformDependent.putShort(nextLinkMemStart + 4, firstLinkOffset);

        // As the existing (batch, offset) pair is moved out of firstLink into nextLink,
        // now put the new (batch, offset) in the firstLink
        PlatformDependent.putInt(firstLinkMemStart, buildBatch);
        PlatformDependent.putShort(firstLinkMemStart + 4, (short) incomingRecordIndex);
      }
    }
  }
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:66,代码来源:VectorizedHashJoinOperator.java

示例10: setCurrentIndex

import io.netty.util.internal.PlatformDependent; //导入方法依赖的package包/类
private void setCurrentIndex(final int hashTableIndex, final int buildBatch, final int incomingRecordIndex) throws SchemaChangeException {

    /* set the current record batch index and the index
     * within the batch at the specified keyIndex. The keyIndex
     * denotes the global index where the key for this record is
     * stored in the hash table
     */
    int hashTableBatch  = hashTableIndex / HashTable.BATCH_SIZE;
    int hashTableOffset = hashTableIndex % HashTable.BATCH_SIZE;

    final ArrowBuf startIndex = startIndices.get(hashTableBatch);
    final long startIndexMemStart = startIndex.memoryAddress() + hashTableOffset * BUILD_RECORD_LINK_SIZE;

    // If head of the list is empty, insert current index at this position
    final int linkBatch = PlatformDependent.getInt(startIndexMemStart);
    if (linkBatch == INDEX_EMPTY) {
      PlatformDependent.putInt(startIndexMemStart, buildBatch);
      PlatformDependent.putShort(startIndexMemStart + 4, (short) incomingRecordIndex);
    } else {
        /* Head of this list is not empty, if the first link
         * is empty insert there
         */
      hashTableBatch = linkBatch;
      hashTableOffset = PlatformDependent.getShort(startIndexMemStart + 4);

      final ArrowBuf firstLink = buildInfoList.get(hashTableBatch).getLinks();
      final long firstLinkMemStart = firstLink.memoryAddress() + hashTableOffset * BUILD_RECORD_LINK_SIZE;

      final int firstLinkBatch = PlatformDependent.getInt(firstLinkMemStart);

      if (firstLinkBatch == INDEX_EMPTY) {
        PlatformDependent.putInt(firstLinkMemStart, buildBatch);
        PlatformDependent.putShort(firstLinkMemStart + 4, (short) incomingRecordIndex);
      } else {
          /* Insert the current value as the first link and
           * make the current first link as its next
           */
        final short firstLinkOffset = PlatformDependent.getShort(firstLinkMemStart + 4);

        final ArrowBuf nextLink = buildInfoList.get(buildBatch).getLinks();
        final long nextLinkMemStart = nextLink.memoryAddress() + incomingRecordIndex * BUILD_RECORD_LINK_SIZE;

        PlatformDependent.putInt(nextLinkMemStart, firstLinkBatch);
        PlatformDependent.putShort(nextLinkMemStart + 4, firstLinkOffset);

        // As the existing (batch, offset) pair is moved out of firstLink into nextLink,
        // now put the new (batch, offset) in the firstLink
        PlatformDependent.putInt(firstLinkMemStart, buildBatch);
        PlatformDependent.putShort(firstLinkMemStart + 4, (short) incomingRecordIndex);
      }
    }
  }
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:53,代码来源:HashJoinOperator.java

示例11: varcharRoundtrip

import io.netty.util.internal.PlatformDependent; //导入方法依赖的package包/类
@Test
public void varcharRoundtrip(){
  final int count = 1024;
  try(
      NullableVarCharVector in = new NullableVarCharVector("in", allocator);
      NullableVarCharVector out = new NullableVarCharVector("out", allocator);
      ){

    in.allocateNew(count * 8, count);

    for(int i = 0; i < count; i++){
      if(i % 5 == 0){
        byte[] data = ("hello-" + i).getBytes(Charsets.UTF_8);
        in.getMutator().setSafe(i, data, 0, data.length);
      }
    }
    in.getMutator().setValueCount(count);

    List<FieldBufferCopier> copiers = FieldBufferCopier.getCopiers(ImmutableList.<FieldVector>of(in), ImmutableList.<FieldVector>of(out));
    try(
        final SelectionVector2 sv2 = new SelectionVector2(allocator);
        ){

      sv2.allocateNew(count);
      // create full sv2.
      int x = 0;
      for(long mem = sv2.memoryAddress(); mem < sv2.memoryAddress() + count * 2; mem+=2){
        PlatformDependent.putShort(mem, (short) (char) x);
        x++;
      }

      sv2.setRecordCount(count);
      copy(copiers, sv2);

      out.getMutator().setValueCount(count);
      for(int i =0; i < count; i++){
        assertEquals(in.getAccessor().getObject(i), out.getAccessor().getObject(i));
      }
    }
  }
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:42,代码来源:TestCopierRoundTrip.java


注:本文中的io.netty.util.internal.PlatformDependent.putShort方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。