本文整理了Java中org.apache.kylin.common.util.Bytes.putInt()
方法的一些代码示例,展示了Bytes.putInt()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Bytes.putInt()
方法的具体详情如下:
包路径:org.apache.kylin.common.util.Bytes
类名称: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);
}
内容来源于网络,如有侵权,请联系作者删除!