org.apache.flume.serialization
Class HeaderAndBodyTextEventSerializer

java.lang.Object
  extended by org.apache.flume.serialization.HeaderAndBodyTextEventSerializer
All Implemented Interfaces:
EventSerializer

public class HeaderAndBodyTextEventSerializer
extends Object
implements EventSerializer

This class simply writes the body of the event to the output stream and appends a newline after each event.


Nested Class Summary
static class HeaderAndBodyTextEventSerializer.Builder
           
 
Field Summary
 
Fields inherited from interface org.apache.flume.serialization.EventSerializer
CTX_PREFIX
 
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 flush()
          Hook to flush any internal write buffers to the underlying stream.
 boolean supportsReopen()
          Specify whether this output format supports reopening files for append.
 void write(Event e)
          Serialize and write the given event.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

supportsReopen

public boolean supportsReopen()
Description copied from interface: EventSerializer
Specify whether this output format supports reopening files for append. For example, this method should return false if EventSerializer.beforeClose() writes a trailer that "finalizes" the file (this type of behavior is file format-specific).
Could have been named supportsAppend().

Specified by:
supportsReopen in interface EventSerializer

afterCreate

public void afterCreate()
Description copied from interface: EventSerializer
Hook to write a header after file is opened for the first time.

Specified by:
afterCreate in interface EventSerializer

afterReopen

public void afterReopen()
Description copied from interface: EventSerializer
Hook to handle any framing needed when file is re-opened (for write).
Could have been named afterOpenForAppend().

Specified by:
afterReopen in interface EventSerializer

beforeClose

public void beforeClose()
Description copied from interface: EventSerializer
Hook to write a trailer before the stream is closed. Implementations must not buffer data in this call since EventSerializer.flush() is not guaranteed to be called after beforeClose().

Specified by:
beforeClose in interface EventSerializer

write

public void write(Event e)
           throws IOException
Description copied from interface: EventSerializer
Serialize and write the given event.

Specified by:
write in interface EventSerializer
Parameters:
e - Event to write to the underlying stream.
Throws:
IOException

flush

public void flush()
           throws IOException
Description copied from interface: EventSerializer
Hook to flush any internal write buffers to the underlying stream. It is NOT necessary for an implementation to then call flush() / sync() on the underlying stream itself, since those semantics would be provided by the driver that calls this API.

Specified by:
flush in interface EventSerializer
Throws:
IOException


Copyright © 2009-2013 Apache Software Foundation. All Rights Reserved.