T - Data type that can be written in the Schema given below.public abstract class AbstractAvroEventSerializer<T> extends Object implements EventSerializer, Configurable
EventSerializer.BuilderCTX_PREFIX| Constructor and Description |
|---|
AbstractAvroEventSerializer() |
| Modifier and Type | Method and Description |
|---|---|
void |
afterCreate()
Hook to write a header after file is opened for the first time.
|
void |
afterReopen()
Hook to handle any framing needed when file is re-opened (for write).
Could have been named afterOpenForAppend(). |
void |
beforeClose()
Hook to write a trailer before the stream is closed.
|
void |
configure(Context context)
Request the implementing class to (re)configure itself.
|
protected abstract T |
convert(Event event)
Simple conversion routine used to convert an Event to a type of your
choosing.
|
void |
flush()
Hook to flush any internal write buffers to the underlying stream.
|
protected abstract OutputStream |
getOutputStream()
Returns the stream to serialize data into.
|
protected abstract org.apache.avro.Schema |
getSchema()
Returns the parsed Avro schema corresponding to the data being written
and the parameterized type specified.
|
boolean |
supportsReopen()
Specify whether this output format supports reopening files for append.
|
void |
write(Event event)
Serialize and write the given event.
|
protected abstract OutputStream getOutputStream()
protected abstract org.apache.avro.Schema getSchema()
protected abstract T convert(Event event)
getSchema().public void configure(Context context)
ConfigurableRequest the implementing class to (re)configure itself.
When configuration parameters are changed, they must be reflected by the component asap.
There are no thread safety guarantees on when configure might be called.
configure in interface Configurablepublic void afterCreate()
throws IOException
EventSerializerafterCreate in interface EventSerializerIOExceptionpublic void afterReopen()
throws IOException
EventSerializerafterOpenForAppend().afterReopen in interface EventSerializerIOExceptionpublic void write(Event event) throws IOException
EventSerializerwrite in interface EventSerializerevent - Event to write to the underlying stream.IOExceptionpublic void flush()
throws IOException
EventSerializerflush in interface EventSerializerIOExceptionpublic void beforeClose()
throws IOException
EventSerializerbeforeClose in interface EventSerializerIOExceptionpublic boolean supportsReopen()
EventSerializerfalse if
EventSerializer.beforeClose() writes a trailer that "finalizes" the file
(this type of behavior is file format-specific).supportsAppend().supportsReopen in interface EventSerializerCopyright © 2009-2022 Apache Software Foundation. All Rights Reserved.