public class IcebergEncoder<D>
extends java.lang.Object
implements org.apache.avro.message.MessageEncoder<D>
Constructor and Description |
---|
IcebergEncoder(Schema schema)
Creates a new
MessageEncoder that will deconstruct datum instances described by the
schema . |
IcebergEncoder(Schema schema,
boolean shouldCopy)
Creates a new
MessageEncoder that will deconstruct datum instances described by the
schema . |
Modifier and Type | Method and Description |
---|---|
java.nio.ByteBuffer |
encode(D datum) |
void |
encode(D datum,
java.io.OutputStream stream) |
public IcebergEncoder(Schema schema)
MessageEncoder
that will deconstruct datum instances described by the
schema
.
Buffers returned by encode
are copied and will not be modified by future calls to
encode
.
schema
- the Schema
for datum instancespublic IcebergEncoder(Schema schema, boolean shouldCopy)
MessageEncoder
that will deconstruct datum instances described by the
schema
.
If shouldCopy
is true, then buffers returned by encode
are copied and will
not be modified by future calls to encode
.
If shouldCopy
is false, then buffers returned by encode
wrap a thread-local
buffer that can be reused by future calls to encode
, but may not be. Callers should
only set shouldCopy
to false if the buffer will be copied before the current thread's
next call to encode
.
schema
- the Schema
for datum instancesshouldCopy
- whether to copy buffers before returning encoded results