org.apfloat.spi
Class FilenameGenerator

java.lang.Object
  extended by org.apfloat.spi.FilenameGenerator

public class FilenameGenerator
extends Object

Class for generating filenames for temporary files.

Version:
1.0
Author:
Mikko Tommila

Constructor Summary
FilenameGenerator(String path, String initialValue, String suffix)
          Create a new filename generator.
 
Method Summary
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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. If null, the default file path from the ApfloatContext is used.
initialValue - The initial value for the numbers. If null, the default file initial value from the ApfloatContext is used.
suffix - The suffix for file names. If null, the default file suffix from the ApfloatContext 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.