org.apache.kylin.common.util.Bytes.putBytes()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(3.8k)|赞(0)|评价(0)|浏览(148)

本文整理了Java中org.apache.kylin.common.util.Bytes.putBytes()方法的一些代码示例,展示了Bytes.putBytes()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Bytes.putBytes()方法的具体详情如下:
包路径:org.apache.kylin.common.util.Bytes
类名称:Bytes
方法名:putBytes

Bytes.putBytes介绍

[英]Put bytes at the specified byte array position.
[中]将字节放在指定的字节数组位置。

代码示例

代码示例来源:origin: apache/kylin

/**
 * Convert a BigDecimal value to a byte array
 *
 * @param val
 * @return the byte array
 */
public static byte[] toBytes(BigDecimal val) {
  byte[] valueBytes = val.unscaledValue().toByteArray();
  byte[] result = new byte[valueBytes.length + SIZEOF_INT];
  int offset = putInt(result, 0, val.scale());
  putBytes(result, offset, valueBytes, 0, valueBytes.length);
  return result;
}

代码示例来源:origin: apache/kylin

/**
 * Put a BigDecimal value out to the specified byte array position.
 *
 * @param bytes  the byte array
 * @param offset position in the array
 * @param val    BigDecimal to write out
 * @return incremented offset
 */
public static int putBigDecimal(byte[] bytes, int offset, BigDecimal val) {
  if (bytes == null) {
    return offset;
  }
  byte[] valueBytes = val.unscaledValue().toByteArray();
  byte[] result = new byte[valueBytes.length + SIZEOF_INT];
  offset = putInt(result, offset, val.scale());
  return putBytes(result, offset, valueBytes, 0, valueBytes.length);
}

代码示例来源:origin: apache/kylin

private void updateRawScanByCurrentRegion(RawScan rawScan, HRegion region, int shardLength) {
  if (shardLength == 0) {
    return;
  }
  byte[] regionStartKey = ArrayUtils.isEmpty(region.getRegionInfo().getStartKey()) ? new byte[shardLength]
      : region.getRegionInfo().getStartKey();
  Bytes.putBytes(rawScan.startKey, 0, regionStartKey, 0, shardLength);
  Bytes.putBytes(rawScan.endKey, 0, regionStartKey, 0, shardLength);
}

代码示例来源:origin: org.apache.kylin/kylin-core-common

/**
 * Convert a BigDecimal value to a byte array
 *
 * @param val
 * @return the byte array
 */
public static byte[] toBytes(BigDecimal val) {
  byte[] valueBytes = val.unscaledValue().toByteArray();
  byte[] result = new byte[valueBytes.length + SIZEOF_INT];
  int offset = putInt(result, 0, val.scale());
  putBytes(result, offset, valueBytes, 0, valueBytes.length);
  return result;
}

代码示例来源:origin: org.apache.kylin/kylin-common

/**
 * Convert a BigDecimal value to a byte array
 *
 * @param val
 * @return the byte array
 */
public static byte[] toBytes(BigDecimal val) {
  byte[] valueBytes = val.unscaledValue().toByteArray();
  byte[] result = new byte[valueBytes.length + SIZEOF_INT];
  int offset = putInt(result, 0, val.scale());
  putBytes(result, offset, valueBytes, 0, valueBytes.length);
  return result;
}

代码示例来源:origin: org.apache.kylin/kylin-common

/**
 * Put a BigDecimal value out to the specified byte array position.
 *
 * @param bytes  the byte array
 * @param offset position in the array
 * @param val    BigDecimal to write out
 * @return incremented offset
 */
public static int putBigDecimal(byte[] bytes, int offset, BigDecimal val) {
  if (bytes == null) {
    return offset;
  }
  byte[] valueBytes = val.unscaledValue().toByteArray();
  byte[] result = new byte[valueBytes.length + SIZEOF_INT];
  offset = putInt(result, offset, val.scale());
  return putBytes(result, offset, valueBytes, 0, valueBytes.length);
}

代码示例来源:origin: org.apache.kylin/kylin-core-common

/**
 * Put a BigDecimal value out to the specified byte array position.
 *
 * @param bytes  the byte array
 * @param offset position in the array
 * @param val    BigDecimal to write out
 * @return incremented offset
 */
public static int putBigDecimal(byte[] bytes, int offset, BigDecimal val) {
  if (bytes == null) {
    return offset;
  }
  byte[] valueBytes = val.unscaledValue().toByteArray();
  byte[] result = new byte[valueBytes.length + SIZEOF_INT];
  offset = putInt(result, offset, val.scale());
  return putBytes(result, offset, valueBytes, 0, valueBytes.length);
}

代码示例来源:origin: org.apache.kylin/kylin-storage-hbase

private void updateRawScanByCurrentRegion(RawScan rawScan, HRegion region, int shardLength) {
  if (shardLength == 0) {
    return;
  }
  byte[] regionStartKey = ArrayUtils.isEmpty(region.getRegionInfo().getStartKey()) ? new byte[shardLength]
      : region.getRegionInfo().getStartKey();
  Bytes.putBytes(rawScan.startKey, 0, regionStartKey, 0, shardLength);
  Bytes.putBytes(rawScan.endKey, 0, regionStartKey, 0, shardLength);
}

相关文章