Class Paths

java.lang.Object
org.assertj.core.util.Paths

public class Paths extends Object
Utility methods related to Paths.
Since:
3.23.0
Author:
Stefan Bratanov
  • Method Details

    • linesOf

      public static List<String> linesOf(Path path, 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:
      NullPointerException - if the given charset is null.
      UncheckedIOException - if an I/O exception occurs.
    • linesOf

      public static List<String> linesOf(Path path, 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:
      NullPointerException - if the given charset is null.
      UncheckedIOException - if an I/O exception occurs.