本文整理了Java中org.apache.hadoop.hbase.util.Bytes.toBigDecimal()
方法的一些代码示例,展示了Bytes.toBigDecimal()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Bytes.toBigDecimal()
方法的具体详情如下:
包路径:org.apache.hadoop.hbase.util.Bytes
类名称:Bytes
方法名:toBigDecimal
[英]Converts a byte array to a BigDecimal
[中]将字节数组转换为BigDecimal
代码示例来源:origin: apache/hbase
/**
* Converts a byte array to a BigDecimal
*
* @param bytes
* @return the char value
*/
public static BigDecimal toBigDecimal(byte[] bytes) {
return toBigDecimal(bytes, 0, bytes.length);
}
代码示例来源:origin: apache/hbase
@Override
public int compareTo(byte[] value, int offset, int length) {
BigDecimal that = Bytes.toBigDecimal(value, offset, length);
return this.bigDecimal.compareTo(that);
}
代码示例来源:origin: apache/hbase
@Override
public BigDecimal getCellValueFromProto(BigDecimalMsg q) {
return Bytes.toBigDecimal(q.getBigdecimalMsg().toByteArray());
}
}
代码示例来源:origin: apache/hbase
@Override
public BigDecimal getPromotedValueFromProto(BigDecimalMsg r) {
return Bytes.toBigDecimal(r.getBigdecimalMsg().toByteArray());
}
代码示例来源:origin: apache/hbase
public void testToBigDecimal() throws Exception {
BigDecimal [] decimals = {new BigDecimal("-1"), new BigDecimal("123.123"),
new BigDecimal("123123123123")};
for (int i = 0; i < decimals.length; i++) {
byte [] b = Bytes.toBytes(decimals[i]);
assertEquals(decimals[i], Bytes.toBigDecimal(b));
byte [] b2 = bytesWithOffset(b);
assertEquals(decimals[i], Bytes.toBigDecimal(b2, 1, b.length));
}
}
代码示例来源:origin: apache/flink
return new Time(Bytes.toLong(value));
case 12:
return Bytes.toBigDecimal(value);
case 13:
return new BigInteger(value);
代码示例来源:origin: alibaba/canal
res = bytes;
} else if (type == Type.BIGDECIMAL) {
res = Bytes.toBigDecimal(bytes);
} else {
throw new IllegalArgumentException("mismatch class type");
代码示例来源:origin: alibaba/canal
res = bytes[0];
} else if (BigDecimal.class == clazz) {
res = Bytes.toBigDecimal(bytes);
} else if (BigInteger.class == clazz) {
res = Bytes.toLong(bytes);
代码示例来源:origin: apache/hbase
/**
* Converts the value bytes of the given cell into a BigDecimal
* @param cell
* @return value as BigDecimal
*/
public static BigDecimal getValueAsBigDecimal(Cell cell) {
if (cell instanceof ByteBufferExtendedCell) {
return ByteBufferUtils.toBigDecimal(((ByteBufferExtendedCell) cell).getValueByteBuffer(),
((ByteBufferExtendedCell) cell).getValuePosition(), cell.getValueLength());
}
return Bytes.toBigDecimal(cell.getValueArray(), cell.getValueOffset(), cell.getValueLength());
}
代码示例来源:origin: apache/hbase
/**
* @param pbBytes A pb serialized {@link BigDecimalComparator} instance
* @return An instance of {@link BigDecimalComparator} made from <code>bytes</code>
* @throws DeserializationException A deserialization exception
* @see #toByteArray
*/
public static BigDecimalComparator parseFrom(final byte[] pbBytes)
throws DeserializationException {
ComparatorProtos.BigDecimalComparator proto;
try {
proto = ComparatorProtos.BigDecimalComparator.parseFrom(pbBytes);
} catch (InvalidProtocolBufferException e) {
throw new DeserializationException(e);
}
return new BigDecimalComparator(Bytes.toBigDecimal(proto.getComparable().getValue()
.toByteArray()));
}
代码示例来源:origin: org.apache.hbase/hbase-client
@Override
public int compareTo(byte[] value, int offset, int length) {
BigDecimal that = Bytes.toBigDecimal(value, offset, length);
return this.bigDecimal.compareTo(that);
}
代码示例来源:origin: org.apache.hbase/hbase-client
@Override
public BigDecimal getCellValueFromProto(BigDecimalMsg q) {
return Bytes.toBigDecimal(q.getBigdecimalMsg().toByteArray());
}
}
代码示例来源:origin: org.apache.hbase/hbase-client
@Override
public BigDecimal getPromotedValueFromProto(BigDecimalMsg r) {
return Bytes.toBigDecimal(r.getBigdecimalMsg().toByteArray());
}
代码示例来源:origin: Impetus/Kundera
return Bytes.toBigDecimal(b);
代码示例来源:origin: Impetus/Kundera
return Bytes.toBigDecimal(b);
代码示例来源:origin: org.apache.hbase/hbase-client
/**
* @param pbBytes A pb serialized {@link BigDecimalComparator} instance
* @return An instance of {@link BigDecimalComparator} made from <code>bytes</code>
* @throws DeserializationException A deserialization exception
* @see #toByteArray
*/
public static BigDecimalComparator parseFrom(final byte[] pbBytes)
throws DeserializationException {
ComparatorProtos.BigDecimalComparator proto;
try {
proto = ComparatorProtos.BigDecimalComparator.parseFrom(pbBytes);
} catch (InvalidProtocolBufferException e) {
throw new DeserializationException(e);
}
return new BigDecimalComparator(Bytes.toBigDecimal(proto.getComparable().getValue()
.toByteArray()));
}
代码示例来源:origin: harbby/presto-connectors
/**
* Converts a byte array to a BigDecimal
*
* @param bytes
* @return the char value
*/
public static BigDecimal toBigDecimal(byte[] bytes) {
return toBigDecimal(bytes, 0, bytes.length);
}
代码示例来源:origin: com.aliyun.hbase/alihbase-client
@Override
public BigDecimal getCellValueFromProto(BigDecimalMsg q) {
return Bytes.toBigDecimal(q.getBigdecimalMsg().toByteArray());
}
}
代码示例来源:origin: org.apache.hbase/hbase-common
public void testToBigDecimal() throws Exception {
BigDecimal [] decimals = {new BigDecimal("-1"), new BigDecimal("123.123"),
new BigDecimal("123123123123")};
for (int i = 0; i < decimals.length; i++) {
byte [] b = Bytes.toBytes(decimals[i]);
assertEquals(decimals[i], Bytes.toBigDecimal(b));
byte [] b2 = bytesWithOffset(b);
assertEquals(decimals[i], Bytes.toBigDecimal(b2, 1, b.length));
}
}
代码示例来源:origin: org.apache.hbase/hbase-common
/**
* Converts the value bytes of the given cell into a BigDecimal
* @param cell
* @return value as BigDecimal
*/
public static BigDecimal getValueAsBigDecimal(Cell cell) {
if (cell instanceof ByteBufferExtendedCell) {
return ByteBufferUtils.toBigDecimal(((ByteBufferExtendedCell) cell).getValueByteBuffer(),
((ByteBufferExtendedCell) cell).getValuePosition(), cell.getValueLength());
}
return Bytes.toBigDecimal(cell.getValueArray(), cell.getValueOffset(), cell.getValueLength());
}
内容来源于网络,如有侵权,请联系作者删除!