Class DefaultFileNameFormat
- java.lang.Object
-
- org.apache.storm.hdfs.bolt.format.DefaultFileNameFormat
-
- All Implemented Interfaces:
Serializable,FileNameFormat
public class DefaultFileNameFormat extends Object implements FileNameFormat
Creates file names with the following format:{prefix}{componentId}-{taskId}-{rotationNum}-{timestamp}{extension}For example:MyBolt-5-7-1390579837830.txtBy default, prefix is empty and extenstion is ".txt".
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description DefaultFileNameFormat()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetName(long rotation, long timeStamp)Returns the filename the HdfsBolt will create.StringgetPath()voidprepare(Map<String,Object> conf, TopologyContext topologyContext)DefaultFileNameFormatwithExtension(String extension)Overrides the default file extension.DefaultFileNameFormatwithPath(String path)DefaultFileNameFormatwithPrefix(String prefix)Overrides the default prefix.
-
-
-
Method Detail
-
withPrefix
public DefaultFileNameFormat withPrefix(String prefix)
Overrides the default prefix.
-
withExtension
public DefaultFileNameFormat withExtension(String extension)
Overrides the default file extension.
-
withPath
public DefaultFileNameFormat withPath(String path)
-
prepare
public void prepare(Map<String,Object> conf, TopologyContext topologyContext)
- Specified by:
preparein interfaceFileNameFormat
-
getName
public String getName(long rotation, long timeStamp)
Description copied from interface:FileNameFormatReturns the filename the HdfsBolt will create.- Specified by:
getNamein interfaceFileNameFormat- Parameters:
rotation- the current file rotation number (incremented on every rotation)timeStamp- current time in milliseconds when the rotation occurs
-
getPath
public String getPath()
- Specified by:
getPathin interfaceFileNameFormat
-
-