- java.lang.Object
-
- kala.compress.utils.FileNameUtils
-
public class FileNameUtils extends java.lang.ObjectGeneric file name utilities.- Since:
- 1.20
-
-
Constructor Summary
Constructors Constructor Description FileNameUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description private static java.lang.StringfileNameToBaseName(java.lang.String name)private static java.lang.StringfileNameToExtension(java.lang.String name)static java.lang.StringgetBaseName(java.lang.String fileName)Gets the base name (i.e.static java.lang.StringgetBaseName(java.nio.file.Path path)Gets the base name (i.e.static java.lang.StringgetExtension(java.lang.String fileName)Gets the extension (i.e.static java.lang.StringgetExtension(java.nio.file.Path path)Gets the extension (i.e.static java.lang.StringgetFileName(java.lang.String path)
-
-
-
Method Detail
-
fileNameToBaseName
private static java.lang.String fileNameToBaseName(java.lang.String name)
-
fileNameToExtension
private static java.lang.String fileNameToExtension(java.lang.String name)
-
getFileName
public static java.lang.String getFileName(java.lang.String path)
- Since:
- 1.27.1-0
-
getBaseName
public static java.lang.String getBaseName(java.nio.file.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 nameparameter are skipped.- Parameters:
path- the path of the file to obtain the base name of.- Returns:
- the base name of file name
- Since:
- 1.22
-
getBaseName
public static java.lang.String getBaseName(java.lang.String fileName)
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 nameparameter are skipped.- Parameters:
fileName- the name of the file to obtain the base name of.- Returns:
- the base name of file name
-
getExtension
public static java.lang.String getExtension(java.nio.file.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 nameparameter are skipped.- Parameters:
path- the path of the file to obtain the extension of.- Returns:
- the extension of file name
- Since:
- 1.22
-
getExtension
public static java.lang.String getExtension(java.lang.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
fileNameparameter are skipped.- Parameters:
fileName- the name of the file to obtain the extension of.- Returns:
- the extension of file name
-
-