de.hpi.fgis.dude.util
Class FilenameManager
java.lang.Object
de.hpi.fgis.dude.util.FilenameManager
public class FilenameManager
- extends Object
The FilenameManager
manages all filenames within a directory. It will check if a filename does already exist within the directory. If
this is the case the FilenameManager
will generate an alternative.
- Author:
- Matthias Pohl
Constructor Summary |
FilenameManager(String directory)
Initializes a FilenameManager for the passed directory. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
FilenameManager
public FilenameManager(String directory)
- Initializes a
FilenameManager
for the passed directory.
- Parameters:
directory
- The directory that will be managed.
- Throws:
IllegalArgumentException
- If a String was passed that is no directory path.
getNextValidFilename
public String getNextValidFilename(String baseFilename)
- Returns a valid alternative for the passed filename.
- Parameters:
baseFilename
- The file for which an alternative is requested. If the observed directory does not contain a file with such a name, the passed
filename will be the return value.
- Returns:
- A valid filename for the observed directory. This alternative can be the passed filename, if there is no file with the given name, or
the passed filename concatenated with an integer value.
Copyright © 2011 Hasso Plattner Institute - Chair of Information Systems. All Rights Reserved.