Top Description Constructors Methods
org.assertj.core.util

public Class URLs

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

Utility methods related to URLs.
Authors
Turbo87, dorzey

Constructor Summary

AccessConstructor and Description
private
URLs()

Method Summary

Modifier and TypeMethod and Description
private static void
public static String

Returns:

the content of the file.
contentOf
(URL
the URL.
url
,
String
the name of the character set to use.
charsetName
)

Loads the text content of a URL into a character string.

public static String

Returns:

the content of the URL.
contentOf
(URL
the URL.
url
,
Charset
the character set to use.
charset
)

Loads the text content of a URL into a character string.

public static List<String>

Returns:

the content of the URL.
linesOf
(URL
the URL.
url
,
Charset
the character set to use.
charset
)

Loads the text content of a URL into a list of strings, each string corresponding to a line.

public static List<String>

Returns:

the content of the URL.
linesOf
(URL
the URL.
url
,
String
the name of the character set to use.
charsetName
)

Loads the text content of a URL into a list of strings, each string corresponding to a line.

private static String
loadContents(InputStream stream, Charset charset)

private static List<String>
loadLines(InputStream stream, Charset charset)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

URLsback to summary
private URLs()

Method Detail

checkArgumentCharsetIsSupportedback to summary
private static void checkArgumentCharsetIsSupported(String charsetName)
contentOfback to summary
public static String contentOf(URL url, String charsetName)

Loads the text content of a URL into a character string.

Parameters
url:URL

the URL.

charsetName:String

the name of the character set to use.

Returns:String

the content of the file.

Exceptions
IllegalArgumentException:
if the given character set is not supported on this platform.
UncheckedIOException:
if an I/O exception occurs.
contentOfback to summary
public static String contentOf(URL url, Charset charset)

Loads the text content of a URL into a character string.

Parameters
url:URL

the URL.

charset:Charset

the character set to use.

Returns:String

the content of the URL.

Exceptions
NullPointerException:
if the given charset is null.
UncheckedIOException:
if an I/O exception occurs.
linesOfback to summary
public static List<String> linesOf(URL url, Charset charset)

Loads the text content of a URL into a list of strings, each string corresponding to a line. The line endings are either \n, \r or \r\n.

Parameters
url:URL

the URL.

charset:Charset

the character set to use.

Returns:List<String>

the content of the URL.

Exceptions
NullPointerException:
if the given charset is null.
UncheckedIOException:
if an I/O exception occurs.
linesOfback to summary
public static List<String> linesOf(URL url, String charsetName)

Loads the text content of a URL into a list of strings, each string corresponding to a line. The line endings are either \n, \r or \r\n.

Parameters
url:URL

the URL.

charsetName:String

the name of the character set to use.

Returns:List<String>

the content of the URL.

Exceptions
NullPointerException:
if the given charset is null.
UncheckedIOException:
if an I/O exception occurs.
loadContentsback to summary
private static String loadContents(InputStream stream, Charset charset) throws IOException
loadLinesback to summary
private static List<String> loadLines(InputStream stream, Charset charset) throws IOException