Top Description Constructors Methods
liquibase.util

public Class FilenameUtil

extends Object
Class Inheritance
Known Direct Subclasses
liquibase.util.file.FilenameUtils
Imports
java.nio.file.InvalidPathException, .Path, .Paths

General filename and filepath manipulation utilities.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static String
concat(String basePath, String fullFilenameToAdd)

Concatenates a filename to a base path using normal command line style rules.

public static String
getDirectory(String filename)

If the path is a file, return everything up to the file.

public static String
normalize(String filename)

Normalizes a path, removing double and single dot path steps as well as standardizing on "/" for a slash.

public static String

Returns:

String Sanitized file name
sanitizeFileName
(String
Filename to remove characters from
fileName
)

Remove problematic characters from filename and replace them with '_'

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

FilenameUtilback to summary
public FilenameUtil()

Method Detail

concatback to summary
public static String concat(String basePath, String fullFilenameToAdd)

Concatenates a filename to a base path using normal command line style rules. This method uses the operating system rules to determine the path separator.

The returned path will be normalize(String)'ed

getDirectoryback to summary
public static String getDirectory(String filename)

If the path is a file, return everything up to the file. If the path is a directory, return the directory.

The returned path will be normalize(String)'ed

normalizeback to summary
public static String normalize(String filename)

Normalizes a path, removing double and single dot path steps as well as standardizing on "/" for a slash.

sanitizeFileNameback to summary
public static String sanitizeFileName(String fileName)

Remove problematic characters from filename and replace them with '_'

Parameters
fileName:String

Filename to remove characters from

Returns:String

String Sanitized file name

See Also
What characters are forbidden in Windows and Linux directory names?

' ' '/' ':' '"' '\' '|' '*' '?' '<' '>'