public final class LongConverter extends Object implements NumericValueConverter, Serializable
Constructor and Description |
---|
LongConverter() |
Modifier and Type | Method and Description |
---|---|
Number |
add(Number num1,
Number num2,
Number... numbers)
Adds two or more numbers.
|
int |
compare(Number num1,
Number num2)
Compares two numbers as longs.
|
Object |
decodeValue(byte[] bytes)
Decode a byte array and convert it into an object depending on the
converter implementation.
|
byte[] |
encodeValue(Object value)
Encode an object as a byte array depending on the converter implementation.
|
static long |
invertLong(long key)
Converts a timestamp into it's inverse timestamp to be used in (row) keys
where we want to have the most recent timestamp in the top of the table
(scans start at the most recent timestamp first).
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
equals
public byte[] encodeValue(Object value) throws IOException
ValueConverter
encodeValue
in interface ValueConverter
value
- Value to be encoded.IOException
- if any problem is encountered while encoding.public Object decodeValue(byte[] bytes) throws IOException
ValueConverter
decodeValue
in interface ValueConverter
bytes
- Byte array to be decoded.IOException
- if any problem is encountered while decoding.public int compare(Number num1, Number num2)
compare
in interface Comparator<Number>
num1
- the first Long
to compare.num2
- the second Long
to compare.public Number add(Number num1, Number num2, Number... numbers)
NumericValueConverter
add
in interface NumericValueConverter
num1
- the first number to add.num2
- the second number to add.numbers
- Rest of the numbers to be added.public static long invertLong(long key)
key
- value to be inverted so that the latest version will be first in
a scan.Copyright © 2022 Apache Software Foundation. All rights reserved.