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


Java DrillBuf.writeBytes方法代码示例

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


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

示例1: readFromStream

import io.netty.buffer.DrillBuf; //导入方法依赖的package包/类
/**
 * Reads from an InputStream and parses a RecordBatchDef. From this, we construct a SelectionVector2 if it exits
 * and construct the vectors and add them to a vector container
 * @param input the InputStream to read from
 * @throws IOException
 */
@Override
public void readFromStream(InputStream input) throws IOException {
  final VectorContainer container = new VectorContainer();
  final UserBitShared.RecordBatchDef batchDef = UserBitShared.RecordBatchDef.parseDelimitedFrom(input);
  recordCount = batchDef.getRecordCount();
  if (batchDef.hasCarriesTwoByteSelectionVector() && batchDef.getCarriesTwoByteSelectionVector()) {

    if (sv2 == null) {
      sv2 = new SelectionVector2(allocator);
    }
    sv2.allocateNew(recordCount * SelectionVector2.RECORD_SIZE);
    sv2.getBuffer().setBytes(0, input, recordCount * SelectionVector2.RECORD_SIZE);
    svMode = BatchSchema.SelectionVectorMode.TWO_BYTE;
  }
  final List<ValueVector> vectorList = Lists.newArrayList();
  final List<SerializedField> fieldList = batchDef.getFieldList();
  for (SerializedField metaData : fieldList) {
    final int dataLength = metaData.getBufferLength();
    final MaterializedField field = MaterializedField.create(metaData);
    final DrillBuf buf = allocator.buffer(dataLength);
    final ValueVector vector;
    try {
      buf.writeBytes(input, dataLength);
      vector = TypeHelper.getNewVector(field, allocator);
      vector.load(metaData, buf);
    } finally {
      buf.release();
    }
    vectorList.add(vector);
  }
  container.addCollection(vectorList);
  container.buildSchema(svMode);
  container.setRecordCount(recordCount);
  va = container;
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:42,代码来源:VectorAccessibleSerializable.java

示例2: decompress

import io.netty.buffer.DrillBuf; //导入方法依赖的package包/类
@Override
public void decompress(DrillBuf input, int compressedSize, DrillBuf output, int uncompressedSize)
    throws IOException {

  decompressor.reset();
  byte[] inputBytes = new byte[input.capacity()];
  input.getBytes(0, inputBytes);
  decompressor.setInput(inputBytes, 0, inputBytes.length);
  byte[] outputBytes = new byte[uncompressedSize];
  decompressor.decompress(outputBytes, 0, uncompressedSize);
  output.clear();
  output.writeBytes(outputBytes);
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:14,代码来源:DirectCodecFactory.java


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