org.apache.flume.serialization
Interface EventDeserializer

All Superinterfaces:
Closeable, Resettable
All Known Subinterfaces:
EventSerDe
All Known Implementing Classes:
AvroEventDeserializer, BlobDeserializer, LineDeserializer

@InterfaceAudience.Public
@InterfaceStability.Evolving
public interface EventDeserializer
extends Resettable, Closeable

Establishes a contract for reading events stored in arbitrary formats from reliable, resettable streams.


Nested Class Summary
static interface EventDeserializer.Builder
          Knows how to construct this deserializer.
Note: Implementations MUST provide a public a no-arg constructor.
 
Method Summary
 void close()
          Calls 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 mark() was never previously called.
 

Method Detail

readEvent

Event readEvent()
                throws IOException
Read a single event from the underlying stream.

Returns:
Deserialized event or null if no events could be read.
Throws:
IOException
See Also:
mark(), reset()

readEvents

List<Event> readEvents(int numEvents)
                       throws IOException
Read a batch of events from the underlying stream.

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:
mark(), reset()

mark

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

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

reset

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

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

close

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

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


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