Class FileUtil


  • public class FileUtil
    extends Object
    Class that provides supplementary methods for working with files and Paths.
    Since:
    1.5.0
    • Method Detail

      • getFileExtension

        public static String getFileExtension​(Path filePath)
        Gets the file extension of the specified path.

        This method does not account for file extensions with more than one dot (.) -- in cases like those, only the last part of the extension will be returned.

        For paths which contain no file extension, an empty String will be returned.

        Parameters:
        filePath - The Path to get the file extension of.
        Returns:
        The Path's file extension.
      • readFileLines

        public static List<String> readFileLines​(Path filePath)
        Reads all lines of a file, as an abstraction of Files.readAllLines(Path) which handles the possible IOException.
        Parameters:
        filePath - The Path of the file to read.
        Returns:
        The lines of the file.