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


Java DrillBuf.getBytes方法代码示例

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


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

示例1: 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

示例2: writeToStream

import io.netty.buffer.DrillBuf; //导入方法依赖的package包/类
/**
 * Serializes the VectorAccessible va and writes it to an output stream
 * @param output the OutputStream to write to
 * @throws IOException
 */
@Override
public void writeToStream(OutputStream output) throws IOException {
  Preconditions.checkNotNull(output);
  final Timer.Context timerContext = metrics.timer(WRITER_TIMER).time();

  final DrillBuf[] incomingBuffers = batch.getBuffers();
  final UserBitShared.RecordBatchDef batchDef = batch.getDef();

  /* DrillBuf associated with the selection vector */
  DrillBuf svBuf = null;
  Integer svCount =  null;

  if (svMode == BatchSchema.SelectionVectorMode.TWO_BYTE) {
    svCount = sv2.getCount();
    svBuf = sv2.getBuffer(); //this calls retain() internally
  }

  try {
    /* Write the metadata to the file */
    batchDef.writeDelimitedTo(output);

    /* If we have a selection vector, dump it to file first */
    if (svBuf != null) {
      svBuf.getBytes(0, output, svBuf.readableBytes());
      sv2.setBuffer(svBuf);
      svBuf.release(); // sv2 now owns the buffer
      sv2.setRecordCount(svCount);
    }

    /* Dump the array of ByteBuf's associated with the value vectors */
    for (DrillBuf buf : incomingBuffers) {
              /* dump the buffer into the OutputStream */
      int bufLength = buf.readableBytes();
      buf.getBytes(0, output, bufLength);
    }

    output.flush();

    timerContext.stop();
  } catch (IOException e) {
    throw new RuntimeException(e);
  } finally {
    clear();
  }
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:51,代码来源:VectorAccessibleSerializable.java

示例3: getBigDecimalFromDrillBuf

import io.netty.buffer.DrillBuf; //导入方法依赖的package包/类
public static BigDecimal getBigDecimalFromDrillBuf(DrillBuf bytebuf, int start, int length, int scale) {
  byte[] value = new byte[length];
  bytebuf.getBytes(start, value, 0, length);
  BigInteger unscaledValue = new BigInteger(value);
  return new BigDecimal(unscaledValue, scale);
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:7,代码来源:DecimalUtility.java

示例4: nfeL

import io.netty.buffer.DrillBuf; //导入方法依赖的package包/类
private static int nfeL(int start, int end, DrillBuf buffer){
  byte[] buf = new byte[end - start];
  buffer.getBytes(start, buf, 0, end - start);
  throw new NumberFormatException(new String(buf, com.google.common.base.Charsets.UTF_8));
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:6,代码来源:StringFunctionHelpers.java

示例5: nfeI

import io.netty.buffer.DrillBuf; //导入方法依赖的package包/类
private static int nfeI(int start, int end, DrillBuf buffer){
  byte[] buf = new byte[end - start];
  buffer.getBytes(start, buf, 0, end - start);
  throw new NumberFormatException(new String(buf, com.google.common.base.Charsets.UTF_8));
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:6,代码来源:StringFunctionHelpers.java

示例6: toStringFromUTF8

import io.netty.buffer.DrillBuf; //导入方法依赖的package包/类
public static String toStringFromUTF8(int start, int end, DrillBuf buffer) {
  byte[] buf = new byte[end - start];
  buffer.getBytes(start, buf, 0, end - start);
  String s = new String(buf, Charsets.UTF_8);
  return s;
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:7,代码来源:StringFunctionHelpers.java

示例7: toStringFromUTF16

import io.netty.buffer.DrillBuf; //导入方法依赖的package包/类
public static String toStringFromUTF16(int start, int end, DrillBuf buffer) {
  byte[] buf = new byte[end - start];
  buffer.getBytes(start, buf, 0, end - start);
  return new String(buf, Charsets.UTF_16);
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:6,代码来源:StringFunctionHelpers.java


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