org.apache.flume.serialization
Class AvroEventDeserializer

java.lang.Object
  extended by org.apache.flume.serialization.AvroEventDeserializer
All Implemented Interfaces:
Closeable, EventDeserializer, Resettable

public class AvroEventDeserializer
extends Object
implements EventDeserializer

A deserializer that parses Avro container files, generating one Flume event per record in the Avro file, and storing binary avro-encoded records in the Flume event body.


Nested Class Summary
static class AvroEventDeserializer.AvroSchemaType
           
static class AvroEventDeserializer.Builder
           
 
Field Summary
static String AVRO_SCHEMA_HEADER_HASH
           
static String AVRO_SCHEMA_HEADER_LITERAL
           
static String CONFIG_SCHEMA_TYPE_KEY
           
 
Method Summary
 void close()
          Calls EventDeserializer.reset() on the stream and then closes it.
 void mark()
          Marks the underlying input stream, indicating that the events previously returned by this EventDeserializer have been successfully committed.
 Event readEvent()
          Read a single event from the underlying stream.
 List<Event> readEvents(int numEvents)
          Read a batch of events from the underlying stream.
 void reset()
          Resets the underlying input stream to the last known mark (or beginning of the stream if EventDeserializer.mark() was never previously called.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CONFIG_SCHEMA_TYPE_KEY

public static final String CONFIG_SCHEMA_TYPE_KEY
See Also:
Constant Field Values

AVRO_SCHEMA_HEADER_HASH

public static final String AVRO_SCHEMA_HEADER_HASH
See Also:
Constant Field Values

AVRO_SCHEMA_HEADER_LITERAL

public static final String AVRO_SCHEMA_HEADER_LITERAL
See Also:
Constant Field Values
Method Detail

readEvent

public Event readEvent()
                throws IOException
Description copied from interface: EventDeserializer
Read a single event from the underlying stream.

Specified by:
readEvent in interface EventDeserializer
Returns:
Deserialized event or null if no events could be read.
Throws:
IOException
See Also:
EventDeserializer.mark(), EventDeserializer.reset()

readEvents

public List<Event> readEvents(int numEvents)
                       throws IOException
Description copied from interface: EventDeserializer
Read a batch of events from the underlying stream.

Specified by:
readEvents in interface EventDeserializer
Parameters:
numEvents - Maximum number of events to return.
Returns:
List of read events, or empty list if no events could be read.
Throws:
IOException
See Also:
EventDeserializer.mark(), EventDeserializer.reset()

mark

public void mark()
          throws IOException
Description copied from interface: EventDeserializer
Marks the underlying input stream, indicating that the events previously returned by this EventDeserializer have been successfully committed.

Specified by:
mark in interface EventDeserializer
Specified by:
mark in interface Resettable
Throws:
IOException
See Also:
EventDeserializer.reset()

reset

public void reset()
           throws IOException
Description copied from interface: EventDeserializer
Resets the underlying input stream to the last known mark (or beginning of the stream if EventDeserializer.mark() was never previously called. This should be done in the case of inability to commit previously-deserialized events.

Specified by:
reset in interface EventDeserializer
Specified by:
reset in interface Resettable
Throws:
IOException
See Also:
EventDeserializer.mark()

close

public void close()
           throws IOException
Description copied from interface: EventDeserializer
Calls EventDeserializer.reset() on the stream and then closes it. In the case of successful completion of event consumption, EventDeserializer.mark() MUST be called before close().

Specified by:
close in interface Closeable
Specified by:
close in interface EventDeserializer
Throws:
IOException
See Also:
EventDeserializer.mark(), EventDeserializer.reset()


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