Top Description Constructors Methods
org.assertj.core.util

public Class Paths

extends Object
Class Inheritance
Static Imports
java.util.Objects.requireNonNull, org.assertj.core.util.Preconditions.checkArgument

Utility methods related to Paths.
Author
Stefan Bratanov
Since
3.23.0

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
private static void
public static List<String>

Returns:

the content of the file at the given path.
linesOf
(Path
the path.
path
,
Charset
the character set to use.
charset
)

Loads the text content of a file at a given path into a list of strings, each string corresponding to a line.

public static List<String>

Returns:

the content of the file at the given path.
linesOf
(Path
the path.
path
,
String
the name of the character set to use.
charsetName
)

Loads the text content of a file at a given path into a list of strings, each string corresponding to a line.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

Pathsback to summary
private Paths()

Method Detail

checkArgumentCharsetIsSupportedback to summary
private static void checkArgumentCharsetIsSupported(String charsetName)
linesOfback to summary
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:Path

the path.

charset:Charset

the character set to use.

Returns:List<String>

the content of the file at the given path.

Exceptions
NullPointerException:
if the given charset is null.
UncheckedIOException:
if an I/O exception occurs.
linesOfback to summary
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:Path

the path.

charsetName:String

the name of the character set to use.

Returns:List<String>

the content of the file at the given path.

Exceptions
NullPointerException:
if the given charset is null.
UncheckedIOException:
if an I/O exception occurs.