public class DefaultFileNameFormat extends Object implements FileNameFormat
{prefix}-{partitionId}-{rotationNum}-{timestamp}{extension}For example:
MyBolt-5-7-1390579837830.txt
By default, prefix is empty and extenstion is ".txt".
Constructor and Description |
---|
DefaultFileNameFormat() |
Modifier and Type | Method and 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.
|
public DefaultFileNameFormat withPrefix(String prefix)
public DefaultFileNameFormat withExtension(String extension)
public DefaultFileNameFormat withPath(String path)
public void prepare(Map<String,Object> conf, int partitionIndex, int numPartitions)
prepare
in interface FileNameFormat
public String getName(long rotation, long timeStamp)
FileNameFormat
getName
in interface FileNameFormat
rotation
- the current file rotation number (incremented on every rotation)timeStamp
- current time in milliseconds when the rotation occurspublic String getPath()
getPath
in interface FileNameFormat
Copyright © 2023 The Apache Software Foundation. All rights reserved.