Class Paths


  • public class Paths
    extends java.lang.Object
    Utility methods related to Paths.
    Since:
    3.23.0
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private Paths()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      private static void checkArgumentCharsetIsSupported​(java.lang.String charsetName)  
      static java.util.List<java.lang.String> linesOf​(java.nio.file.Path path, java.lang.String charsetName)
      Loads the text content of a file at a given path into a list of strings, each string corresponding to a line.
      static java.util.List<java.lang.String> linesOf​(java.nio.file.Path path, java.nio.charset.Charset charset)
      Loads the text content of a file at a given path into a list of strings, each string corresponding to a line.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Paths

        private Paths()
    • Method Detail

      • linesOf

        public static java.util.List<java.lang.String> linesOf​(java.nio.file.Path path,
                                                               java.nio.charset.Charset charset)
        Loads the text content of a file at a given path into a list of strings, each string corresponding to a line. The line endings are either \n, \r or \r\n.
        Parameters:
        path - the path.
        charset - the character set to use.
        Returns:
        the content of the file at the given path.
        Throws:
        java.lang.NullPointerException - if the given charset is null.
        java.io.UncheckedIOException - if an I/O exception occurs.
      • linesOf

        public static java.util.List<java.lang.String> linesOf​(java.nio.file.Path path,
                                                               java.lang.String charsetName)
        Loads the text content of a file at a given path into a list of strings, each string corresponding to a line. The line endings are either \n, \r or \r\n.
        Parameters:
        path - the path.
        charsetName - the name of the character set to use.
        Returns:
        the content of the file at the given path.
        Throws:
        java.lang.NullPointerException - if the given charset is null.
        java.io.UncheckedIOException - if an I/O exception occurs.
      • checkArgumentCharsetIsSupported

        private static void checkArgumentCharsetIsSupported​(java.lang.String charsetName)