org.apache.flume.source.taildir

## Class ReliableTaildirEventReader

- java.lang.Object
- - org.apache.flume.source.taildir.ReliableTaildirEventReader

- All Implemented Interfaces:
    Closeable, AutoCloseable, EventReader, ReliableEventReader

      @InterfaceAudience.Private
      @InterfaceStability.Evolving
      public class ReliableTaildirEventReader
      extends Object
      implements ReliableEventReader

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `ReliableTaildirEventReader.Builder` Special builder class for ReliableTaildirEventReader

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `close()` Clean-up any state associated with this reader.
    `void` | `commit()` Commit the last lines which were read.
    `Map<Long,TailFile>` | `getTailFiles()`
    `void` | `loadPositionFile(String filePath)` Load a position file which has the last read position of each file.
    `Event` | `readEvent()` Get the next line associated with the input stream.
    `List<Event>` | `readEvents(int numEvents)` Get up to `n` lines associated with the input stream.
    `List<Event>` | `readEvents(int numEvents, boolean backoffWithoutNL)`
    `List<Event>` | `readEvents(TailFile tf, int numEvents)`
    `void` | `setCurrentFile(TailFile currentFile)`
    `List<Long>` | `updateTailFiles()`
    `List<Long>` | `updateTailFiles(boolean skipToEnd)` Update tailFiles mapping if a new file is created or appends are detected to the existing file.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Method Detail

    - #### loadPositionFile

          public void loadPositionFile(String filePath)

      Load a position file which has the last read position of each file. If the position file exists, update tailFiles mapping.

    - #### getTailFiles

          public Map<Long,TailFile> getTailFiles()

    - #### setCurrentFile

          public void setCurrentFile(TailFile currentFile)

    - #### readEvent

          public Event readEvent()
                          throws IOException

      Description copied from interface: `EventReader`
      Get the next line associated with the input stream. If this returns `null`, the input underlying input source is considered finished. Note that this is allowed to block for indefinite amounts of time waiting to generate a new line.
      Specified by:
        `readEvent` in interface `EventReader`
      Throws:
        `IOException`

    - #### readEvents

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

      Description copied from interface: `EventReader`
      Get up to `n` lines associated with the input stream. If this returns less than n lines, the input underlying input source is considered finished. Note that this is allowed to block for indefinite amounts of time waiting to generate a new line.
      Specified by:
        `readEvents` in interface `EventReader`
      Throws:
        `IOException`

    - #### readEvents

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

      Throws:
        `IOException`

    - #### readEvents

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

      Throws:
        `IOException`

    - #### close

          public void close()
                     throws IOException

      Description copied from interface: `EventReader`
      Clean-up any state associated with this reader.
      Specified by:
        `close` in interface `Closeable`
      Specified by:
        `close` in interface `AutoCloseable`
      Specified by:
        `close` in interface `EventReader`
      Throws:
        `IOException`

    - #### commit

          public void commit()
                      throws IOException

      Commit the last lines which were read.
      Specified by:
        `commit` in interface `ReliableEventReader`
      Throws:
        `IOException`

    - #### updateTailFiles

          public List<Long> updateTailFiles(boolean skipToEnd)
                                     throws IOException

      Update tailFiles mapping if a new file is created or appends are detected to the existing file.
      Throws:
        `IOException`

    - #### updateTailFiles

          public List<Long> updateTailFiles()
                                     throws IOException

      Throws:
        `IOException`

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