|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.flume.serialization.AbstractAvroEventSerializer<T>
T
- Data type that can be written in the Schema given below.public abstract class AbstractAvroEventSerializer<T>
This is a helper class provided to make it straightforward to serialize Flume events into Avro data.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface org.apache.flume.serialization.EventSerializer |
---|
EventSerializer.Builder |
Field Summary |
---|
Fields inherited from interface org.apache.flume.serialization.EventSerializer |
---|
CTX_PREFIX |
Constructor Summary | |
---|---|
AbstractAvroEventSerializer()
|
Method Summary | |
---|---|
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AbstractAvroEventSerializer()
Method Detail |
---|
protected abstract OutputStream getOutputStream()
protected abstract org.apache.avro.Schema getSchema()
protected abstract T convert(Event event)
getSchema()
.
public void configure(Context context)
Configurable
Request 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 guarrantees on when configure might be called.
configure
in interface Configurable
public void afterCreate() throws IOException
EventSerializer
afterCreate
in interface EventSerializer
IOException
public void afterReopen() throws IOException
EventSerializer
afterOpenForAppend()
.
afterReopen
in interface EventSerializer
IOException
public void write(Event event) throws IOException
EventSerializer
write
in interface EventSerializer
event
- Event to write to the underlying stream.
IOException
public void flush() throws IOException
EventSerializer
flush
in interface EventSerializer
IOException
public void beforeClose() throws IOException
EventSerializer
beforeClose
in interface EventSerializer
IOException
public boolean supportsReopen()
EventSerializer
false
if
EventSerializer.beforeClose()
writes a trailer that "finalizes" the file
(this type of behavior is file format-specific).supportsAppend()
.
supportsReopen
in interface EventSerializer
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |