- java.lang.Object
-
- com.pervasive.datarush.encoding.binary.AbstractTokenEncoder
-
- com.pervasive.datarush.encoding.binary.AbstractScalarEncoder
-
- All Implemented Interfaces:
TokenEncoder
public abstract class AbstractScalarEncoder extends AbstractTokenEncoder
Base class for scalar encoders. Handles uniform encoding of null values.
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractScalarEncoder()
Initializes a new encoder.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
encode(BinaryBuilder buffer)
This implementation invokesencodeScalar(BinaryBuilder)
in the event that the source is non-null.void
encodeField(BinaryBuilder buffer, int index)
This implementation delegates toTokenEncoder.encode(BinaryBuilder)
.protected abstract void
encodeScalar(BinaryBuilder buffer)
Subclasses must override this method to handle the encoding of the value.-
Methods inherited from class com.pervasive.datarush.encoding.binary.AbstractTokenEncoder
doSourceUpdated, getSource, setSource
-
-
-
-
Method Detail
-
encode
public final void encode(BinaryBuilder buffer)
This implementation invokesencodeScalar(BinaryBuilder)
in the event that the source is non-null.- Parameters:
buffer
- the buffer to which to append the encoding
-
encodeField
public void encodeField(BinaryBuilder buffer, int index)
Description copied from class:AbstractTokenEncoder
This implementation delegates toTokenEncoder.encode(BinaryBuilder)
. Implementations that require field-specific handling should override this method instead.- Specified by:
encodeField
in interfaceTokenEncoder
- Overrides:
encodeField
in classAbstractTokenEncoder
- Parameters:
buffer
- the buffer to which to append the encodingindex
- the index of the field to encode
-
encodeScalar
protected abstract void encodeScalar(BinaryBuilder buffer)
Subclasses must override this method to handle the encoding of the value. This method is guaranteed to only be invoked if non-null.- Parameters:
buffer
- The buffer to encode into.
-
-