2.17.2: 2011-06-17

net.sf.basedb.util.bfs
Class SuggestedFilenameGenerator

java.lang.Object
  extended by net.sf.basedb.util.bfs.AbstractFilenameGenerator<Object>
      extended by 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) $

Constructor Summary
SuggestedFilenameGenerator()
           
 
Method Summary
 String getNextFilename(Object owner, String suggestedFilename)
          Get the next file name.
 
Methods inherited from class net.sf.basedb.util.bfs.AbstractFilenameGenerator
addFilename, isUnique, makeUnique
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SuggestedFilenameGenerator

public SuggestedFilenameGenerator()
Method Detail

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 file
suggestedFilename - A default suggested file name (can be null)
Returns:
A unique file name

2.17.2: 2011-06-17