org.apache.flume.serialization

## Class LineDeserializer

- java.lang.Object
- - org.apache.flume.serialization.LineDeserializer

- All Implemented Interfaces:
    Closeable, AutoCloseable, EventDeserializer, Resettable

      @InterfaceAudience.Private
      @InterfaceStability.Evolving
      public class LineDeserializer
      extends Object
      implements EventDeserializer

  A deserializer that parses text lines from a file.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `LineDeserializer.Builder`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String` | `CHARSET_DFLT`
    `static int` | `MAXLINE_DFLT`
    `static String` | `MAXLINE_KEY`
    `static String` | `OUT_CHARSET_KEY`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `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()` Reads a line from a file and returns an event
    `List<Event>` | `readEvents(int numEvents)` Batch line read
    `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

    - #### OUT_CHARSET_KEY

          public static final String OUT_CHARSET_KEY

      See Also:
        Constant Field Values

    - #### CHARSET_DFLT

          public static final String CHARSET_DFLT

      See Also:
        Constant Field Values

    - #### MAXLINE_KEY

          public static final String MAXLINE_KEY

      See Also:
        Constant Field Values

    - #### MAXLINE_DFLT

          public static final int MAXLINE_DFLT

      See Also:
        Constant Field Values

  - ### Method Detail

    - #### readEvent

          public Event readEvent()
                          throws IOException

      Reads a line from a file and returns an event
      Specified by:
        `readEvent` in interface `EventDeserializer`
      Returns:
        Event containing parsed line
      Throws:
        `IOException`
      See Also:
        `EventDeserializer.mark()`, `EventDeserializer.reset()`

    - #### readEvents

          public List<Event> readEvents(int numEvents)
                                 throws IOException

      Batch line read
      Specified by:
        `readEvents` in interface `EventDeserializer`
      Parameters:
        `numEvents` - Maximum number of events to return.
      Returns:
        List of events containing read lines
      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 `AutoCloseable`
      Specified by:
        `close` in interface `EventDeserializer`
      Throws:
        `IOException`
      See Also:
        `EventDeserializer.mark()`, `EventDeserializer.reset()`

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