public class FileNameUtils extends Object
| Constructor and Description |
|---|
FileNameUtils() |
| Modifier and Type | Method and Description |
|---|---|
static String |
getBaseName(Path path)
Gets the base name (i.e.
|
static String |
getBaseName(String fileName)
Gets the base name (i.e.
|
static String |
getExtension(Path path)
Gets the extension (i.e.
|
static String |
getExtension(String fileName)
Gets the extension (i.e.
|
public static String getBaseName(Path path)
Will return the file name itself if it doesn't contain any
dots. All leading directories of the file name parameter
are skipped.
path - the path of the file to obtain the base name of.public static String getBaseName(String fileName)
Will return the file name itself if it doesn't contain any
dots. All leading directories of the file name parameter
are skipped.
fileName - the name of the file to obtain the base name of.public static String getExtension(Path path)
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.
path - the path of the file to obtain the extension of.public static String getExtension(String fileName)
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.
fileName - the name of the file to obtain the extension of.Copyright © 2002–2025. All rights reserved.