com.vertica.sdk.vmap.v1.Encoder Class Reference

Inheritance diagram for com.vertica.sdk.vmap.v1.Encoder:

Collaboration diagram for com.vertica.sdk.vmap.v1.Encoder:

Classes
class MatchingKeySelector
Public Member Functions
Encoder (TypeCoercion coercion)
int byteSize ()
void consume (Map data)
void consume (Iterator> data)
void consume (Iterator> data, int sizeEstimate)
ByteBuffer encode ()
void encode (ByteBuffer buffer)
String keyForIdent (String ident)

Detailed Description

An encoder able to generate a VMap, Vertica's aggregate data type.

To use, call consume followed by encode().

Constructor & Destructor Documentation

com.vertica.sdk.vmap.v1.Encoder.Encoder(TypeCoercion coercion)

Create an Encoder instance.

Parameters

  • coercion: A TypeCoercion instance used to provide guidance on serializing input data before encoding it into a VMap.

Member Function Documentation

int com.vertica.sdk.vmap.v1.Encoder.byteSize()

Returns the output length of the encoded VMap. Available only after consume.

Returns The byte size of the output vmap.

Referenced by com.vertica.sdk.vmap.v1.Encoder.encode().

void com.vertica.sdk.vmap.v1.Encoder.consume(Map data)

Execute the consume phase of encoding.

Parameters

  • data: A map of data specified with String keys.

Referenced by com.vertica.sdk.vmap.v1.Encoder.consume().

void com.vertica.sdk.vmap.v1.Encoder.consume(Iterator> data)

Execute the consume phase of encoding with a default guess at the number of data elements.

Parameters

  • data: An iterator over a map-like object which has all String keys.
void com.vertica.sdk.vmap.v1.Encoder.consume(Iterator> data, int sizeEstimate)

Execute the consume phase of encoding.

Parameters

  • data: An iterator over a map-like object which has all String keys.
  • sizeEstimate: A guess at the number of elements found in data. Iterators do not provide a means of querying size.
ByteBuffer com.vertica.sdk.vmap.v1.Encoder.encode()

Get the encoded VMap as a new ByteBuffer.

Returns A ByteBuffer with the VMap representation from 0 to limit.

void com.vertica.sdk.vmap.v1.Encoder.encode(ByteBuffer buffer)

Write the VMap into a ByteBuffer and return the number of bytes written. The buffer's position will be advanced to the end of the VMap.

Parameters

  • buffer: The target buffer, which must have at least byteSize() remaining, or a BufferOverflowException will result.
String com.vertica.sdk.vmap.v1.Encoder.keyForIdent(String ident)

Returns the key name of the first key that matches ident according to identifier comparison. Requires that data already be consumed.

See Also #consume(Map)

Implements com.vertica.sdk.vmap.v1.KeySelector.