org.pdfsam.console.utils.perfix
Class PrefixParser
java.lang.Object
org.pdfsam.console.utils.perfix.PrefixParser
public class PrefixParser
- extends java.lang.Object
Used to parse the prefix and generate the output filename. If the prefix doesn't contain "[CURRENTPAGE]" or "[TIMESTAMP]" it generates oldstyle file name (Ex.
005_prefixFileName.pdf. If it contains "[CURRENTPAGE]", "[TIMESTAMP]" or [FILENUMBER] and depending on the generateFileName method you call, it performs variable substitution.
(Ex. [BASENAME]_prefix_[CURRENTPAGE] generates FileName_prefix_005.pdf) Available variables: [CURRENTPAGE], [TIMESTAMP], [BASENAME], [FILENUMBER]. [CURRENTPAGE] and [FILENUMBER]
accept the notation [FILENUMBER####] to specify the output pattern (Ex if the prefix is [FILENUMBER####] and file number is 5 the resulting prefix will be 0005)
- Author:
- a.vacondio
Constructor Summary |
PrefixParser(java.lang.String prefix,
java.lang.String fileName)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
PrefixParser
public PrefixParser(java.lang.String prefix,
java.lang.String fileName)
throws ConsoleException
- Parameters:
prefix
- prefix to use. (Can be empty)fileName
- Original file name
- Throws:
ConsoleException
- if the original fileName in empty or null
generateFileName
public java.lang.String generateFileName(FileNameRequest request)
- Generates the filename depending on the type of prefix. If it contains "[CURRENTPAGE]","[TIMESTAMP]","[BOOKMARK_NAME]" or "[FILENUMBER]" it performs variable substitution.
- Parameters:
request
- input parameter
- Returns:
- filename generated
generateFileName
public java.lang.String generateFileName()
- Generates the filename depending on the type of prefix. If it contains "[TIMESTAMP]" or "[BASENAME]" it performs variable substitution.
- Returns:
- filename generated