Top Description Constructors Methods
org.apache.commons.compress.utils

public Class FileNameUtils

extends Object
Class Inheritance
Imports
java.io.File, java.nio.file.Path, org.apache.commons.io.FilenameUtils

Generic file name utilities.
Since
1.20

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static String

Returns:

the base name of file name
getBaseName
(final Path
the path of the file to obtain the base name of.
path
)

Gets the base name (i.e. the part up to and not including the last ".") of the last path segment of a file name.

public static String

Returns:

the base name of file name
getBaseName
(final String
the name of the file to obtain the base name of.
fileName
)

Deprecated No longer used, no replacement.
Gets the base name (i.e. the part up to and not including the last ".") of the last path segment of a file name.
public static String

Returns:

the extension of file name
getExtension
(final Path
the path of the file to obtain the extension of.
path
)

Gets the extension (i.e. the part after the last ".") of a file.

public static String

Returns:

the extension of file name
getExtension
(final String
the name of the file to obtain the extension of.
fileName
)

Gets the extension (i.e. the part after the last ".") of a file.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

FileNameUtilsback to summary
public FileNameUtils()

Method Detail

getBaseNameback to summary
public static String getBaseName(final Path path)

Gets the base name (i.e. the part up to and not including the last ".") of the last path segment of a file name.

Will return the file name itself if it doesn't contain any dots. All leading directories of the file name parameter are skipped.

Parameters
path:Path

the path of the file to obtain the base name of.

Returns:String

the base name of file name

Since
1.22
getBaseNameback to summary
public static String getBaseName(final String fileName)

Deprecated

No longer used, no replacement.

Gets the base name (i.e. the part up to and not including the last ".") of the last path segment of a file name.

Will return the file name itself if it doesn't contain any dots. All leading directories of the file name parameter are skipped.

Parameters
fileName:String

the name of the file to obtain the base name of.

Returns:String

the base name of file name

Annotations
@Deprecated
getExtensionback to summary
public static String getExtension(final Path path)

Gets the extension (i.e. the part after the last ".") of a file.

Will return an empty string if the file name doesn't contain any dots. Only the last segment of a the file name is consulted - i.e. all leading directories of the file name parameter are skipped.

Parameters
path:Path

the path of the file to obtain the extension of.

Returns:String

the extension of file name

Since
1.22
getExtensionback to summary
public static String getExtension(final String fileName)

Gets the extension (i.e. the part after the last ".") of a file.

Will return an empty string if the file name doesn't contain any dots. Only the last segment of a the file name is consulted - i.e. all leading directories of the fileName parameter are skipped.

Parameters
fileName:String

the name of the file to obtain the extension of.

Returns:String

the extension of file name

Annotations
@Deprecated