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>
public class SuggestedFilenameGenerator
- extends AbstractFilenameGenerator<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 (Tue, 12 Jan 2010) $
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SuggestedFilenameGenerator
public SuggestedFilenameGenerator()
getNextFilename
public String getNextFilename(Object owner,
String suggestedFilename)
- 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 the
DataWriterFactory
implementation).
- Parameters:
owner
- The owner of the data in the filesuggestedFilename
- A default suggested file name (can be null)
- Returns:
- A unique file name