Class DefaultFileNameFormat
- java.lang.Object
-
- org.apache.storm.hdfs.trident.format.DefaultFileNameFormat
-
- All Implemented Interfaces:
Serializable
,FileNameFormat
public class DefaultFileNameFormat extends Object implements FileNameFormat
Creates file names with the following format:{prefix}-{partitionId}-{rotationNum}-{timestamp}{extension}
For example:MyBolt-5-7-1390579837830.txt
By 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 String
getName(long rotation, long timeStamp)
Returns the filename the HdfsBolt will create.String
getPath()
void
prepare(Map<String,Object> conf, int partitionIndex, int numPartitions)
DefaultFileNameFormat
withExtension(String extension)
Overrides the default file extension.DefaultFileNameFormat
withPath(String path)
DefaultFileNameFormat
withPrefix(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, int partitionIndex, int numPartitions)
- Specified by:
prepare
in interfaceFileNameFormat
-
getName
public String getName(long rotation, long timeStamp)
Description copied from interface:FileNameFormat
Returns the filename the HdfsBolt will create.- Specified by:
getName
in 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:
getPath
in interfaceFileNameFormat
-
-