Package org.apfloat.spi
Class FilenameGenerator
- java.lang.Object
-
- org.apfloat.spi.FilenameGenerator
-
public class FilenameGenerator extends Object
Class for generating filenames for temporary files.- Version:
- 1.0
- Author:
- Mikko Tommila
-
-
Constructor Summary
Constructors Constructor Description FilenameGenerator(String path, String initialValue, String suffix)
Create a new filename generator.
-
Method Summary
Modifier and Type Method Description String
generateFilename()
Generate a filename.String
getInitialValue()
Returns the current initial value of the base file names generated.String
getPath()
Returns the path setting of this filename generator.String
getSuffix()
Returns the suffix setting of this filename generator.
-
-
-
Constructor Detail
-
FilenameGenerator
public FilenameGenerator(String path, String initialValue, String suffix) throws NumberFormatException
Create a new filename generator. The generated filenames will point to the specified directory path. The base file name is a sequential number. The specified suffix is appended to the final file name.- Parameters:
path
- The path where the file are created. Ifnull
, the default file path from theApfloatContext
is used.initialValue
- The initial value for the numbers. Ifnull
, the default file initial value from theApfloatContext
is used.suffix
- The suffix for file names. Ifnull
, the default file suffix from theApfloatContext
is used.- Throws:
NumberFormatException
- If initialValue is not a valid integer number.
-
-
Method Detail
-
generateFilename
public String generateFilename()
Generate a filename. The returned filename is unique among those generated by this filename generator.- Returns:
- A generated file name.
-
getPath
public String getPath()
Returns the path setting of this filename generator.- Returns:
- The path setting of this filename generator.
-
getInitialValue
public String getInitialValue()
Returns the current initial value of the base file names generated.- Returns:
- The current initial value of the base file names generated.
-
getSuffix
public String getSuffix()
Returns the suffix setting of this filename generator.- Returns:
- The suffix setting of this filename generator.
-
-