Vertica documentation is moving! Use our new documentation site at https://docs.rocketsoftware.com/bundle/vertica_12.0/page/index.html

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< String,?> data)
void consume (Iterator< Map.Entry< String, Object >> data)
void consume (Iterator< Map.Entry< String, Object >> 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< String,?> 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< Map.Entry< String, Object >> 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< Map.Entry< String, Object >> 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.