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

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

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

Bytes.putInt介绍

[英]Put an int value out to the specified byte array position.
[中]将int值输出到指定的字节数组位置。

代码示例

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

/**
 * @param bytes  byte array
 * @param offset offset to write to
 * @param f      float value
 * @return New offset in <code>bytes</code>
 */
public static int putFloat(byte[] bytes, int offset, float f) {
  return putInt(bytes, offset, Float.floatToRawIntBits(f));
}

代码示例来源: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: org.apache.kylin/kylin-core-common

/**
 * @param bytes  byte array
 * @param offset offset to write to
 * @param f      float value
 * @return New offset in <code>bytes</code>
 */
public static int putFloat(byte[] bytes, int offset, float f) {
  return putInt(bytes, offset, Float.floatToRawIntBits(f));
}

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

/**
 * @param bytes  byte array
 * @param offset offset to write to
 * @param f      float value
 * @return New offset in <code>bytes</code>
 */
public static int putFloat(byte[] bytes, int offset, float f) {
  return putInt(bytes, offset, Float.floatToRawIntBits(f));
}

代码示例来源: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);
}

相关文章