Class TypeStrategies
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classRead and write a non-null ARRAY which is permitted to have null elements (all elements are always read and written with aNullableTypeStrategywrapper on theTypeStrategyof theTypeSignature.getElementType().static final classRead and write non-null DOUBLE values.static final classRead and write non-null FLOAT values.static final classRead and write non-null LONG values.static final classstatic final classRead and write non-null UTF8 encoded String values. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final ConcurrentHashMap<String, TypeStrategy<?>> static final TypeStrategies.DoubleTypeStrategystatic final TypeStrategies.FloatTypeStrategystatic final bytestatic final bytestatic final TypeStrategies.LongTypeStrategystatic final TypeStrategies.NestedDataTypeStrategystatic final intstatic final intstatic final intstatic final TypeStrategies.StringTypeStrategystatic final int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidcheckMaxSize(int available, int maxSizeBytes, TypeSignature<?> signature) static TypeStrategy<?> getComplex(String typeName) Get anTypeStrategyregistered to someTypeSignature.getComplexTypeName().static booleanisNullableNull(ByteBuffer buffer, int offset) Checks if a 'nullable' value's null byte is set toIS_NULL_BYTE.static doublereadNotNullNullableDouble(ByteBuffer buffer, int offset) Reads a non-null double value from aByteBufferat the supplied offset.static floatreadNotNullNullableFloat(ByteBuffer buffer, int offset) Reads a non-null float value from aByteBufferat the supplied offset.static longreadNotNullNullableLong(ByteBuffer buffer, int offset) Reads a non-null long value from aByteBufferat the supplied offset.static voidregisterComplex(String typeName, TypeStrategy<?> strategy) hmm...static intwriteNotNullNullableDouble(ByteBuffer buffer, int offset, double value) Write a non-null double value to aByteBufferat the supplied offset.static intwriteNotNullNullableFloat(ByteBuffer buffer, int offset, float value) Write a non-null float value to aByteBufferat the supplied offset.static intwriteNotNullNullableLong(ByteBuffer buffer, int offset, long value) Write a non-null long value to aByteBufferat the supplied offset.static intwriteNull(ByteBuffer buffer, int offset) Clear and set the 'null' byte of a nullable value toIS_NULL_BYTEto aByteBufferat the supplied position.
-
Field Details
-
IS_NULL_BYTE
public static final byte IS_NULL_BYTE- See Also:
-
IS_NOT_NULL_BYTE
public static final byte IS_NOT_NULL_BYTE- See Also:
-
VALUE_OFFSET
public static final int VALUE_OFFSET- See Also:
-
NULLABLE_LONG_SIZE
public static final int NULLABLE_LONG_SIZE- See Also:
-
NULLABLE_DOUBLE_SIZE
public static final int NULLABLE_DOUBLE_SIZE- See Also:
-
NULLABLE_FLOAT_SIZE
public static final int NULLABLE_FLOAT_SIZE- See Also:
-
LONG
-
FLOAT
-
DOUBLE
-
STRING
-
NESTED
-
COMPLEX_STRATEGIES
-
-
Constructor Details
-
TypeStrategies
public TypeStrategies()
-
-
Method Details
-
getComplex
Get anTypeStrategyregistered to someTypeSignature.getComplexTypeName(). -
registerComplex
hmm... this might look familiar... (see ComplexMetrics)Register a complex type name ->
TypeStrategymapping.If the specified type name is already used and the supplied
TypeStrategyis not of the same type as the existing value in the map for said key, anISEis thrown.- Parameters:
strategy- TheTypeStrategyobject to be associated with the 'type' in the map.
-
writeNull
Clear and set the 'null' byte of a nullable value toIS_NULL_BYTEto aByteBufferat the supplied position. This method does not change the buffer position, limit, or mark, because it does not expect to own the buffer given to it (i.e. buffer aggs)Nullable types are stored with a leading byte to indicate if the value is null, followed by the value bytes (if not null)
layout: | null (byte) | value |
- Returns:
- number of bytes written (always 1)
-
isNullableNull
Checks if a 'nullable' value's null byte is set toIS_NULL_BYTE. This method will mask the value of the null byte to only check if the null bit is set, meaning that the higher bits can be utilized for flags as necessary (e.g. using high bits to indicate if the value has been set or not for aggregators).Note that writing nullable values with the methods of
Typeswill always clear and set the null byte to eitherIS_NULL_BYTEorIS_NOT_NULL_BYTE, losing any flag bits.layout: | null (byte) | value |
-
writeNotNullNullableLong
Write a non-null long value to aByteBufferat the supplied offset. The first byte is always cleared and set toIS_NOT_NULL_BYTE, the long value is written in the next 8 bytes.layout: | null (byte) | long |
This method does not change the buffer position, limit, or mark, because it does not expect to own the buffer given to it (i.e. buffer aggs)
- Returns:
- number of bytes written (always 9)
-
readNotNullNullableLong
Reads a non-null long value from aByteBufferat the supplied offset. This method should only be called if and only ifisNullableNull(java.nio.ByteBuffer, int)for the same offset returns false.layout: | null (byte) | long |
This method does not change the buffer position, limit, or mark, because it does not expect to own the buffer given to it (i.e. buffer aggs)
-
writeNotNullNullableDouble
Write a non-null double value to aByteBufferat the supplied offset. The first byte is always cleared and set toIS_NOT_NULL_BYTE, the double value is written in the next 8 bytes.layout: | null (byte) | double |
This method does not change the buffer position, limit, or mark, because it does not expect to own the buffer given to it (i.e. buffer aggs)
- Returns:
- number of bytes written (always 9)
-
readNotNullNullableDouble
Reads a non-null double value from aByteBufferat the supplied offset. This method should only be called if and only ifisNullableNull(java.nio.ByteBuffer, int)for the same offset returns false.layout: | null (byte) | double |
This method does not change the buffer position, limit, or mark, because it does not expect to own the buffer given to it (i.e. buffer aggs)
-
writeNotNullNullableFloat
Write a non-null float value to aByteBufferat the supplied offset. The first byte is always cleared and set toIS_NOT_NULL_BYTE, the float value is written in the next 4 bytes.layout: | null (byte) | float |
This method does not change the buffer position, limit, or mark, because it does not expect to own the buffer given to it (i.e. buffer aggs)
- Returns:
- number of bytes written (always 5)
-
readNotNullNullableFloat
Reads a non-null float value from aByteBufferat the supplied offset. This method should only be called if and only ifisNullableNull(java.nio.ByteBuffer, int)for the same offset returns false.layout: | null (byte) | float |
This method does not change the buffer position, limit, or mark, because it does not expect to own the buffer given to it (i.e. buffer aggs)
-
checkMaxSize
-