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 newMessageEncoder
that will deconstruct datum instances described by theschema
.IcebergEncoder(Schema schema, boolean shouldCopy)
Creates a newMessageEncoder
that will deconstruct datum instances described by theschema
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.nio.ByteBuffer
encode(D datum)
void
encode(D datum, java.io.OutputStream stream)
-
-
-
Constructor Detail
-
IcebergEncoder
public IcebergEncoder(Schema schema)
Creates a newMessageEncoder
that will deconstruct datum instances described by theschema
.Buffers returned by
encode
are copied and will not be modified by future calls toencode
.- Parameters:
schema
- theSchema
for datum instances
-
IcebergEncoder
public IcebergEncoder(Schema schema, boolean shouldCopy)
Creates a newMessageEncoder
that will deconstruct datum instances described by theschema
.If
shouldCopy
is true, then buffers returned byencode
are copied and will not be modified by future calls toencode
.If
shouldCopy
is false, then buffers returned byencode
wrap a thread-local buffer that can be reused by future calls toencode
, but may not be. Callers should only setshouldCopy
to false if the buffer will be copied before the current thread's next call toencode
.- Parameters:
schema
- theSchema
for datum instancesshouldCopy
- whether to copy buffers before returning encoded results
-
-