Package org.apache.commons.compress.utils

# Class FileNameUtils

java.lang.Object
org.apache.commons.compress.utils.FileNameUtils

public class FileNameUtils extends Object
Generic file name utilities.

Since:
  1.20

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `FileNameUtils()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static String`
  `getBaseName(String filename)`
  Gets the basename (i.e.
  `static String`
  `getBaseName(Path path)`
  Gets the basename (i.e.
  `static String`
  `getExtension(String filename)`
  Gets the extension (i.e.
  `static String`
  `getExtension(Path path)`
  Gets the extension (i.e.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### FileNameUtils

    public FileNameUtils()

- ## Method Details

  - ### getBaseName

    public static String getBaseName(Path path)
    Gets the basename (i.e. the part up to and not including the last ".") of the last path segment of a filename.

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

    Parameters:
      `path` - the path of the file to obtain the basename of.
    Returns:
      the basename of filename
    Since:
      1.22

  - ### getBaseName

    public static String getBaseName(String filename)
    Gets the basename (i.e. the part up to and not including the last ".") of the last path segment of a filename.

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

    Parameters:
      `filename` - the name of the file to obtain the basename of.
    Returns:
      the basename of filename

  - ### getExtension

    public static String getExtension(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 `filename` parameter are skipped.

    Parameters:
      `path` - the path of the file to obtain the extension of.
    Returns:
      the extension of filename
    Since:
      1.22

  - ### getExtension

    public static String getExtension(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` - the name of the file to obtain the extension of.
    Returns:
      the extension of filename