Interface DataType<T>
- All Known Implementing Classes:
- FixedLengthWrapper,- OrderedBlob,- OrderedBlobVar,- OrderedBytesBase,- OrderedFloat32,- OrderedFloat64,- OrderedInt16,- OrderedInt32,- OrderedInt64,- OrderedInt8,- OrderedNumeric,- OrderedString,- PBCell,- PBType,- RawByte,- RawBytes,- RawBytesFixedLength,- RawBytesTerminated,- RawDouble,- RawFloat,- RawInteger,- RawLong,- RawShort,- RawString,- RawStringFixedLength,- RawStringTerminated,- Struct,- TerminatedWrapper,- Union2,- Union3,- Union4
 DataType is the base class for all HBase data types. Data type implementations are
 designed to be serialized to and deserialized from byte[]. Serialized representations can retain
 the natural sort ordering of the source object, when a suitable encoding is supported by the
 underlying implementation. This is a desirable feature for use in rowkeys and column qualifiers.
 
 DataTypes are different from Hadoop
 ImmutableBytesWritables in two significant ways. First,
 DataType describes how to serialize a value, it does not encapsulate a serialized value.
 Second, DataType implementations provide hints to consumers about relationships between
 the POJOs they represent and richness of the encoded representation.
 
 Data type instances are designed to be stateless, thread-safe, and reused. Implementations should
 provide static final instances corresponding to each variation on configurable
 parameters. This is to encourage and simplify instance reuse. For instance, order-preserving
 types should provide static ASCENDING and DESCENDING instances. It is also encouraged for
 implementations operating on Java primitive types to provide primitive implementations of the
 encode and decode methods. This advice is a performance consideration to clients
 reading and writing values in tight loops.
 
- 
Method SummaryModifier and TypeMethodDescriptionRead an instance ofTfrom the buffersrc.intencode(PositionedByteRange dst, T val) Write instancevalinto bufferdst.Inform consumers over what type thisDataTypeoperates.intencodedLength(T val) Inform consumers how long the encodedbyte[]will be.getOrder()Retrieve the sortOrderimposed by this data type, or null when natural ordering is not preserved.booleanIndicates whether this instance supports encoding null values.booleanIndicates whether this instance writes encodedbyte[]'s which preserve the natural sort order of the unencoded value.booleanIndicates whether this instance is able to skip over it's encoded value.intskip(PositionedByteRange src) Skipsrc's position forward over one encoded value.
- 
Method Details- 
isOrderPreservingboolean isOrderPreserving()Indicates whether this instance writes encodedbyte[]'s which preserve the natural sort order of the unencoded value.- Returns:
- truewhen natural order is preserved,- falseotherwise.
 
- 
getOrderRetrieve the sortOrderimposed by this data type, or null when natural ordering is not preserved. Value is either ascending or descending. Default is assumed to beOrder.ASCENDING.
- 
isNullableboolean isNullable()Indicates whether this instance supports encoding null values. This depends on the implementation details of the encoding format. AllDataTypes that support null should treat null as comparing less than any non-null value for default sort ordering purposes.- Returns:
- truewhen null is supported,- falseotherwise.
 
- 
isSkippableboolean isSkippable()Indicates whether this instance is able to skip over it's encoded value.DataTypes that are not skippable can only be used as the right-most field of aStruct.
- 
encodedLengthInform consumers how long the encodedbyte[]will be.- Parameters:
- val- The value to check.
- Returns:
- the number of bytes required to encode val.a
 
- 
encodedClassClass<T> encodedClass()Inform consumers over what type thisDataTypeoperates. Useful when working with bareDataTypeinstances.
- 
skipSkipsrc's position forward over one encoded value.- Parameters:
- src- the buffer containing the encoded value.
- Returns:
- number of bytes skipped.
 
- 
decodeRead an instance ofTfrom the buffersrc.- Parameters:
- src- the buffer containing the encoded value.
 
- 
encodeWrite instancevalinto bufferdst.- Parameters:
- dst- the buffer containing the encoded value.
- val- the value to encode onto- dst.
- Returns:
- number of bytes written.
 
 
-