org.apache.hadoop.hbase.types
Class OrderedNumeric

java.lang.Object
  extended by org.apache.hadoop.hbase.types.OrderedBytesBase<Number>
      extended by org.apache.hadoop.hbase.types.OrderedNumeric
All Implemented Interfaces:
DataType<Number>

@InterfaceAudience.Public
@InterfaceStability.Evolving
public class OrderedNumeric
extends OrderedBytesBase<Number>

An 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).


Field Summary
static OrderedNumeric ASCENDING
           
static OrderedNumeric DESCENDING
           
 
Fields inherited from class org.apache.hadoop.hbase.types.OrderedBytesBase
order
 
Constructor Summary
protected OrderedNumeric(Order order)
           
 
Method Summary
 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.
 
Methods inherited from class org.apache.hadoop.hbase.types.OrderedBytesBase
getOrder, isNullable, isOrderPreserving, isSkippable, skip
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ASCENDING

public static final OrderedNumeric ASCENDING

DESCENDING

public static final OrderedNumeric DESCENDING
Constructor Detail

OrderedNumeric

protected OrderedNumeric(Order order)
Method Detail

encodedLength

public int encodedLength(Number val)
Description copied from interface: DataType
Inform consumers how long the encoded byte[] will be.

Parameters:
val - The value to check.
Returns:
the number of bytes required to encode val.a

encodedClass

public Class<Number> encodedClass()
Description copied from interface: DataType
Inform consumers over what type this DataType operates. Useful when working with bare DataType instances.


decode

public Number decode(PositionedByteRange src)
Description copied from interface: DataType
Read an instance of T from the buffer src.

Parameters:
src - the buffer containing the encoded value.

encode

public int encode(PositionedByteRange dst,
                  Number val)
Description copied from interface: DataType
Write instance val into buffer dst.

Parameters:
dst - the buffer containing the encoded value.
val - the value to encode onto dst.
Returns:
number of bytes written.

decodeLong

public long decodeLong(PositionedByteRange src)
Read a long value from the buffer src.


encodeLong

public int encodeLong(PositionedByteRange dst,
                      long val)
Write instance val into buffer dst.


decodeDouble

public double decodeDouble(PositionedByteRange src)
Read a double value from the buffer src.


encodeDouble

public int encodeDouble(PositionedByteRange dst,
                        double val)
Write instance val into buffer dst.



Copyright © 2007–2015 The Apache Software Foundation. All rights reserved.