Package org.apache.hadoop.hbase.types
Class PBType<T extends org.apache.hbase.thirdparty.com.google.protobuf.Message>
java.lang.Object
org.apache.hadoop.hbase.types.PBType<T>
- All Implemented Interfaces:
DataType<T>
- Direct Known Subclasses:
PBCell
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintencodedLength(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.static org.apache.hbase.thirdparty.com.google.protobuf.CodedInputStreamCreate aCodedInputStreamfrom aPositionedByteRange.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.static org.apache.hbase.thirdparty.com.google.protobuf.CodedOutputStreamCreate aCodedOutputStreamfrom aPositionedByteRange.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.hadoop.hbase.types.DataType
decode, encode, encodedClass, skip
-
Constructor Details
-
PBType
public PBType()
-
-
Method Details
-
isOrderPreserving
Description copied from interface:DataTypeIndicates whether this instance writes encodedbyte[]'s which preserve the natural sort order of the unencoded value.- Specified by:
isOrderPreservingin interfaceDataType<T extends org.apache.hbase.thirdparty.com.google.protobuf.Message>- Returns:
truewhen natural order is preserved,falseotherwise.
-
getOrder
Description copied from interface:DataTypeRetrieve 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. -
isNullable
Description copied from interface:DataTypeIndicates 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.- Specified by:
isNullablein interfaceDataType<T extends org.apache.hbase.thirdparty.com.google.protobuf.Message>- Returns:
truewhen null is supported,falseotherwise.
-
isSkippable
Description copied from interface:DataTypeIndicates 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.- Specified by:
isSkippablein interfaceDataType<T extends org.apache.hbase.thirdparty.com.google.protobuf.Message>
-
encodedLength
Description copied from interface:DataTypeInform consumers how long the encodedbyte[]will be.- Specified by:
encodedLengthin interfaceDataType<T extends org.apache.hbase.thirdparty.com.google.protobuf.Message>- Parameters:
val- The value to check.- Returns:
- the number of bytes required to encode
val.a
-
inputStreamFromByteRange
public static org.apache.hbase.thirdparty.com.google.protobuf.CodedInputStream inputStreamFromByteRange(PositionedByteRange src) Create aCodedInputStreamfrom aPositionedByteRange. Be sure to updatesrc's position after consuming from the stream. For example:Foo.Builder builder = ... CodedInputStream is = inputStreamFromByteRange(src); Foo ret = builder.mergeFrom(is).build(); src.setPosition(src.getPosition() + is.getTotalBytesRead());
-
outputStreamFromByteRange
public static org.apache.hbase.thirdparty.com.google.protobuf.CodedOutputStream outputStreamFromByteRange(PositionedByteRange dst) Create aCodedOutputStreamfrom aPositionedByteRange. Be sure to updatedst's position after writing to the stream. For example:CodedOutputStream os = outputStreamFromByteRange(dst); int before = os.spaceLeft(), after, written; val.writeTo(os); after = os.spaceLeft(); written = before - after; dst.setPosition(dst.getPosition() + written);
-