Package net.sf.basedb.util.bfs
Class SuggestedFilenameGenerator
java.lang.Object
net.sf.basedb.util.bfs.AbstractFilenameGenerator<Object>
net.sf.basedb.util.bfs.SuggestedFilenameGenerator
- All Implemented Interfaces:
FilenameGenerator<Object>
File name generator implementation that uses the suggested file name.
The implementation returns the suggested file name after making sure
that it is unique. Non-unique suggestions are transformed with a simple
algorithm that adds a sequence number to the file name. Eg. if the file
name 'example.txt' is suggested three times, this generator will return
'example.txt', 'example-2.txt', 'example-3.txt'.
- Version:
- 2.15
- Author:
- Nicklas
- Last modified
- $Date: 2010-01-12 14:21:49 +0100 (ti, 12 jan 2010) $
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiongetNextFilename
(Object owner, String suggestedFilename) Get the next file name.Methods inherited from class net.sf.basedb.util.bfs.AbstractFilenameGenerator
addFilename, isUnique, makeUnique
-
Constructor Details
-
SuggestedFilenameGenerator
public SuggestedFilenameGenerator()
-
-
Method Details
-
getNextFilename
Description copied from interface:FilenameGenerator
Get the next file name. This method should never return the same file name more than one time (given a single implementor instance). The generator implementation should not concern itself with the underlying file system or if the file already exists or not (this is a task for theDataWriterFactory
implementation).- Parameters:
owner
- The owner of the data in the filesuggestedFilename
- A default suggested file name (can be null)- Returns:
- A unique file name
-