- All Known Subinterfaces:
ComparableTokenEncoder
- All Known Implementing Classes:
AbstractScalarEncoder,AbstractTokenEncoder
public interface TokenEncoder
Converts token values into a binary encoding. Implementations
should extend
AbstractTokenEncoder rather than implementing
this interface directly.-
Method Summary
Modifier and TypeMethodDescriptionvoidencode(BinaryBuilder buffer) Appends the encoded version of the current value of the source to the supplied buffer.voidencodeField(BinaryBuilder buffer, int index) Appends the encoded version of the current value of the source to the supplied buffer.voidsetSource(TokenValued source) Sets the container holding values to be encoded.
-
Method Details
-
setSource
Sets the container holding values to be encoded. A reference to this container is held and accessed only when an encoding is requested.- Parameters:
source- the value container to encode
-
encode
Appends the encoded version of the current value of the source to the supplied buffer.- Parameters:
buffer- the buffer to which to append the encoding
-
encodeField
Appends the encoded version of the current value of the source to the supplied buffer.- Parameters:
buffer- the buffer to which to append the encodingindex- the index of the field to encode
-