@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
Deprecated.
since 3.0.0 and will be removed in 4.0.0
|
static OrderedNumeric |
DESCENDING
Deprecated.
since 3.0.0 and will be removed in 4.0.0
|
order
Constructor and Description |
---|
OrderedNumeric(Order order)
Creates a new
Number of arbitrary precision and variable-length encoding. |
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
@Deprecated public static final OrderedNumeric ASCENDING
@Deprecated public static final OrderedNumeric DESCENDING
public OrderedNumeric(Order order)
Number
of arbitrary precision and variable-length encoding.order
- the Order
to usepublic 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
.src
- the PositionedByteRange
to read the long
fromlong
read from the bufferpublic int encodeLong(PositionedByteRange dst, long val)
val
into buffer dst
.dst
- the PositionedByteRange
to write toval
- the value to write to dst
public double decodeDouble(PositionedByteRange src)
double
value from the buffer src
.src
- the PositionedByteRange
to read the double
fromdouble
read from the bufferpublic int encodeDouble(PositionedByteRange dst, double val)
val
into buffer dst
.dst
- the PositionedByteRange
to write toval
- the value to write to dst
Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.