Package org.apache.storm.hdfs.bolt.rotation

# Class FileSizeRotationPolicy

java.lang.Object
org.apache.storm.hdfs.bolt.rotation.FileSizeRotationPolicy

All Implemented Interfaces:
  `Serializable`, `FileRotationPolicy`

public class FileSizeRotationPolicy extends Object implements FileRotationPolicy
File rotation policy that will rotate files when a certain file size is reached.

For example:

         // rotate when files reach 5MB
         FileSizeRotationPolicy policy =
              new FileSizeRotationPolicy(5.0, Units.MB);

See Also:
  - Serialized Form

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `static enum`
  `FileSizeRotationPolicy.Units`

- ## Constructor Summary

  Constructors
  Modifier
  Constructor
  Description
  ``
  `FileSizeRotationPolicy(float count, FileSizeRotationPolicy.Units units)`
  `protected`
  `FileSizeRotationPolicy(long maxBytes)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `FileRotationPolicy`
  `copy()`
  Must be able to copy the rotation policy.
  `boolean`
  `mark(Tuple tuple, long offset)`
  Called for every tuple the HdfsBolt executes.
  `void`
  `reset()`
  Called after the HdfsBolt rotates a file.

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

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

- ## Constructor Details

  - ### FileSizeRotationPolicy

    public FileSizeRotationPolicy(float count, FileSizeRotationPolicy.Units units)

  - ### FileSizeRotationPolicy

    protected FileSizeRotationPolicy(long maxBytes)

- ## Method Details

  - ### mark

    public boolean mark(Tuple tuple, long offset)
    Description copied from interface: `FileRotationPolicy`
    Called for every tuple the HdfsBolt executes.
    Specified by:
      `mark` in interface `FileRotationPolicy`
    Parameters:
      `tuple` - The tuple executed.
      `offset` - current offset of file being written
    Returns:
      true if a file rotation should be performed

  - ### reset

    public void reset()
    Description copied from interface: `FileRotationPolicy`
    Called after the HdfsBolt rotates a file.
    Specified by:
      `reset` in interface `FileRotationPolicy`

  - ### copy

    public FileRotationPolicy copy()
    Description copied from interface: `FileRotationPolicy`
    Must be able to copy the rotation policy.
    Specified by:
      `copy` in interface `FileRotationPolicy`