org.pdfsam.guiclient.utils
Class FileExtensionUtility

java.lang.Object
  extended by org.pdfsam.guiclient.utils.FileExtensionUtility

public final class FileExtensionUtility
extends java.lang.Object

Utility class for the file extensions related tasks

Author:
Andrea Vacondio

Field Summary
static java.lang.String PDF_EXTENSION
           
static java.lang.String TXT_EXTENSION
           
static java.lang.String XML_EXTENSION
           
 
Method Summary
static java.io.File ensureExtension(java.io.File file, java.lang.String fileExtension)
          Ensures that the file in input has the input file extension, if not it adds the extension.
static java.lang.String ensureExtension(java.lang.String filePath, java.lang.String fileExtension)
          Ensures that the file path in input has the input file extension, if not it adds the extension.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PDF_EXTENSION

public static final java.lang.String PDF_EXTENSION
See Also:
Constant Field Values

XML_EXTENSION

public static final java.lang.String XML_EXTENSION
See Also:
Constant Field Values

TXT_EXTENSION

public static final java.lang.String TXT_EXTENSION
See Also:
Constant Field Values
Method Detail

ensureExtension

public static java.lang.String ensureExtension(java.lang.String filePath,
                                               java.lang.String fileExtension)
Ensures that the file path in input has the input file extension, if not it adds the extension.

Parameters:
filePath -
fileExtension - the file extension without leading dot (Ex. pdf)
Returns:
the correct file path (with file extension added if necessasy)

ensureExtension

public static java.io.File ensureExtension(java.io.File file,
                                           java.lang.String fileExtension)
Ensures that the file in input has the input file extension, if not it adds the extension.

Parameters:
file -
fileExtension - the file extension without leading dot (Ex. pdf)
Returns:
the correct file path (with file extension added if necessasy)