@InterfaceAudience.Public public class OrderedNumeric extends OrderedBytesBase<Number>
Number
of arbitrary precision and variable-length encoding. The resulting length of
encoded values is determined by the numerical (base 100) precision, not absolute value. Use this
data type anywhere you would expect to use a DECIMAL
type, a BigDecimal
, a
BigInteger
, or any time you've parsed floating precision values from text. Built on
OrderedBytes.encodeNumeric(PositionedByteRange, BigDecimal, Order)
.Modifier and Type | Field and Description |
---|---|
static OrderedNumeric |
ASCENDING |
static OrderedNumeric |
DESCENDING |
order
Modifier | Constructor and Description |
---|---|
protected |
OrderedNumeric(Order order) |
Modifier and Type | Method and Description |
---|---|
Number |
decode(PositionedByteRange src)
Read an instance of
T from the buffer src . |
double |
decodeDouble(PositionedByteRange src)
Read a
double value from the buffer src . |
long |
decodeLong(PositionedByteRange src)
Read a
long value from the buffer src . |
int |
encode(PositionedByteRange dst,
Number val)
Write instance
val into buffer dst . |
Class<Number> |
encodedClass()
Inform consumers over what type this
DataType operates. |
int |
encodedLength(Number val)
Inform consumers how long the encoded
byte[] will be. |
int |
encodeDouble(PositionedByteRange dst,
double val)
Write instance
val into buffer dst . |
int |
encodeLong(PositionedByteRange dst,
long val)
Write instance
val into buffer dst . |
getOrder, isNullable, isOrderPreserving, isSkippable, skip
public static final OrderedNumeric ASCENDING
public static final OrderedNumeric DESCENDING
protected OrderedNumeric(Order order)
public int encodedLength(Number val)
DataType
byte[]
will be.val
- The value to check.val
.apublic Class<Number> encodedClass()
DataType
DataType
operates. Useful when working with bare
DataType
instances.public Number decode(PositionedByteRange src)
DataType
T
from the buffer src
.src
- the buffer containing the encoded value.public int encode(PositionedByteRange dst, Number val)
DataType
val
into buffer dst
.dst
- the buffer containing the encoded value.val
- the value to encode onto dst
.public long decodeLong(PositionedByteRange src)
long
value from the buffer src
.public int encodeLong(PositionedByteRange dst, long val)
val
into buffer dst
.public double decodeDouble(PositionedByteRange src)
double
value from the buffer src
.public int encodeDouble(PositionedByteRange dst, double val)
val
into buffer dst
.Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.