The im4java Library, Version 1.4.0

org.im4java.utils
Class FilenamePatternResolver

java.lang.Object
  extended by org.im4java.utils.FilenamePatternResolver

public class FilenamePatternResolver
extends java.lang.Object

This utility-class creates filenames from an input file and a template.

The template recognizes the following escape-sequences:

Since:
1.1.0
Version:
$Revision: 1.5 $
Author:
$Author: bablokb $

Constructor Summary
FilenamePatternResolver(java.lang.String pTemplate)
          Constructor (uses the default escape-char of %).
FilenamePatternResolver(java.lang.String pTemplate, char pEscChar)
          Constructor.
 
Method Summary
 java.lang.String createName(java.lang.String pFilename)
          Generate a filename based on the input-file and the template.
 java.lang.String getDrive(java.io.File pFile)
          Get the drive-letter of the given file.
 java.lang.String getExt(java.io.File pFile)
          Get the extension of the given file
 java.lang.String getFullname(java.io.File pFile)
          Get the full filename of the given file
 java.lang.String getFullpath(java.io.File pFile)
          Get the full pathname of the given file
 java.lang.String getName(java.io.File pFile)
          Get the filename of the given file (filename without extension).
 java.lang.String getPath(java.io.File pFile)
          Get the pathname of the given file
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FilenamePatternResolver

public FilenamePatternResolver(java.lang.String pTemplate)
Constructor (uses the default escape-char of %).

Parameters:
pTemplate - The template for this FilenamePatternResolver

FilenamePatternResolver

public FilenamePatternResolver(java.lang.String pTemplate,
                               char pEscChar)
Constructor.

Parameters:
pTemplate - The template for this FilenamePatternResolver
pEscChar - The escape-character used in pTemplate
Method Detail

createName

public java.lang.String createName(java.lang.String pFilename)
Generate a filename based on the input-file and the template.

Parameters:
pFilename - The input-filename
Returns:
The new filename based on the template as a String

getDrive

public java.lang.String getDrive(java.io.File pFile)
Get the drive-letter of the given file. On none-windows systems, this method always returns the empty string. Note that this method does not work for UNC-filenames.

Parameters:
pFile - The input file
Returns:
The drive-letter or the empty string

getFullpath

public java.lang.String getFullpath(java.io.File pFile)
Get the full pathname of the given file

Parameters:
pFile - The input file
Returns:
The full pathname

getPath

public java.lang.String getPath(java.io.File pFile)
Get the pathname of the given file

Parameters:
pFile - The input file
Returns:
The pathname

getFullname

public java.lang.String getFullname(java.io.File pFile)
Get the full filename of the given file

Parameters:
pFile - The input file
Returns:
The full filename

getName

public java.lang.String getName(java.io.File pFile)
Get the filename of the given file (filename without extension).

Parameters:
pFile - The input file
Returns:
The filename

getExt

public java.lang.String getExt(java.io.File pFile)
Get the extension of the given file

Parameters:
pFile - The input file
Returns:
The filename

The im4java Library, Version 1.4.0

Released under the LGPL, (c) Bernhard Bablok 2008-2010
Homepage: http://im4java.sourceforge.net/