Package org.apache.iceberg.data.avro
Class IcebergEncoder<D>
- java.lang.Object
-
- org.apache.iceberg.data.avro.IcebergEncoder<D>
-
- All Implemented Interfaces:
org.apache.avro.message.MessageEncoder<D>
public class IcebergEncoder<D> extends java.lang.Object implements org.apache.avro.message.MessageEncoder<D>
-
-
Constructor Summary
Constructors Constructor Description IcebergEncoder(Schema schema)Creates a newMessageEncoderthat will deconstruct datum instances described by theschema.IcebergEncoder(Schema schema, boolean shouldCopy)Creates a newMessageEncoderthat will deconstruct datum instances described by theschema.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.nio.ByteBufferencode(D datum)voidencode(D datum, java.io.OutputStream stream)
-
-
-
Constructor Detail
-
IcebergEncoder
public IcebergEncoder(Schema schema)
Creates a newMessageEncoderthat will deconstruct datum instances described by theschema.Buffers returned by
encodeare copied and will not be modified by future calls toencode.- Parameters:
schema- theSchemafor datum instances
-
IcebergEncoder
public IcebergEncoder(Schema schema, boolean shouldCopy)
Creates a newMessageEncoderthat will deconstruct datum instances described by theschema.If
shouldCopyis true, then buffers returned byencodeare copied and will not be modified by future calls toencode.If
shouldCopyis false, then buffers returned byencodewrap a thread-local buffer that can be reused by future calls toencode, but may not be. Callers should only setshouldCopyto false if the buffer will be copied before the current thread's next call toencode.- Parameters:
schema- theSchemafor datum instancesshouldCopy- whether to copy buffers before returning encoded results
-
-