Package org.apache.storm.hdfs.common

## Class AbstractHDFSWriter

- java.lang.Object
- - org.apache.storm.hdfs.common.AbstractHDFSWriter

- All Implemented Interfaces:
    `Writer`
  Direct Known Subclasses:
    `AvroGenericRecordHDFSWriter`, `HDFSWriter`, `SequenceFileWriter`

      public abstract class AbstractHDFSWriter
      extends Object
      implements Writer

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `protected org.apache.hadoop.fs.Path` | `filePath` |
    `protected long` | `lastUsedTime` |
    `protected boolean` | `needsRotation` |
    `protected long` | `offset` |
    `protected FileRotationPolicy` | `rotationPolicy` |

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `AbstractHDFSWriter​(FileRotationPolicy policy, org.apache.hadoop.fs.Path path)` |

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `close()` |
    `protected abstract void` | `doClose()` |
    `protected abstract void` | `doSync()` |
    `protected abstract void` | `doWrite​(Tuple tuple)` |
    `org.apache.hadoop.fs.Path` | `getFilePath()` |
    `boolean` | `needsRotation()` |
    `void` | `sync()` |
    `long` | `write​(Tuple tuple)` |

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

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

- - ### Field Detail

    - #### filePath

          protected final org.apache.hadoop.fs.Path filePath

    - #### rotationPolicy

          protected final FileRotationPolicy rotationPolicy

    - #### lastUsedTime

          protected long lastUsedTime

    - #### offset

          protected long offset

    - #### needsRotation

          protected boolean needsRotation

  - ### Constructor Detail

    - #### AbstractHDFSWriter

          public AbstractHDFSWriter​(FileRotationPolicy policy,
                                    org.apache.hadoop.fs.Path path)

  - ### Method Detail

    - #### write

          public final long write​(Tuple tuple)
                           throws IOException

      Specified by:
        `write` in interface `Writer`
      Throws:
        `IOException`

    - #### sync

          public final void sync()
                          throws IOException

      Specified by:
        `sync` in interface `Writer`
      Throws:
        `IOException`

    - #### close

          public final void close()
                           throws IOException

      Specified by:
        `close` in interface `Writer`
      Throws:
        `IOException`

    - #### needsRotation

          public boolean needsRotation()

      Specified by:
        `needsRotation` in interface `Writer`

    - #### getFilePath

          public org.apache.hadoop.fs.Path getFilePath()

      Specified by:
        `getFilePath` in interface `Writer`

    - #### doWrite

          protected abstract void doWrite​(Tuple tuple)
                                   throws IOException

      Throws:
        `IOException`

    - #### doSync

          protected abstract void doSync()
                                  throws IOException

      Throws:
        `IOException`

    - #### doClose

          protected abstract void doClose()
                                   throws IOException

      Throws:
        `IOException`