Package org.assertj.core.util
Class URLs
- java.lang.Object
-
- org.assertj.core.util.URLs
-
public class URLs extends Object
Utility methods related to URLs.- Author:
- Turbo87, dorzey
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static StringcontentOf(URL url, String charsetName)Loads the text content of a URL into a character string.static StringcontentOf(URL url, Charset charset)Loads the text content of a URL into a character string.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.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.
-
-
-
Method Detail
-
contentOf
public static String contentOf(URL url, String charsetName)
Loads the text content of a URL into a character string.- Parameters:
url- the URL.charsetName- the name of the character set to use.- Returns:
- the content of the file.
- Throws:
IllegalArgumentException- if the given character set is not supported on this platform.RuntimeIOException- if an I/O exception occurs.
-
contentOf
public static String contentOf(URL url, Charset charset)
Loads the text content of a URL into a character string.- Parameters:
url- the URL.charset- the character set to use.- Returns:
- the content of the URL.
- Throws:
NullPointerException- if the given charset isnull.RuntimeIOException- if an I/O exception occurs.
-
linesOf
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- the URL.charset- the character set to use.- Returns:
- the content of the URL.
- Throws:
NullPointerException- if the given charset isnull.RuntimeIOException- if an I/O exception occurs.
-
linesOf
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- the URL.charsetName- the name of the character set to use.- Returns:
- the content of the URL.
- Throws:
NullPointerException- if the given charset isnull.RuntimeIOException- if an I/O exception occurs.
-
-