Package org.assertj.core.util
Class URLs
- java.lang.Object
-
- org.assertj.core.util.URLs
-
public class URLs extends java.lang.ObjectUtility methods related to URLs.
-
-
Constructor Summary
Constructors Modifier Constructor Description privateURLs()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description private static voidcheckArgumentCharsetIsSupported(java.lang.String charsetName)static java.lang.StringcontentOf(java.net.URL url, java.lang.String charsetName)Loads the text content of a URL into a character string.static java.lang.StringcontentOf(java.net.URL url, java.nio.charset.Charset charset)Loads the text content of a URL into a character string.static java.util.List<java.lang.String>linesOf(java.net.URL url, java.lang.String charsetName)Loads the text content of a URL into a list of strings, each string corresponding to a line.static java.util.List<java.lang.String>linesOf(java.net.URL url, java.nio.charset.Charset charset)Loads the text content of a URL into a list of strings, each string corresponding to a line.private static java.lang.StringloadContents(java.io.InputStream stream, java.nio.charset.Charset charset)private static java.util.List<java.lang.String>loadLines(java.io.InputStream stream, java.nio.charset.Charset charset)
-
-
-
Method Detail
-
contentOf
public static java.lang.String contentOf(java.net.URL url, java.lang.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:
java.lang.IllegalArgumentException- if the given character set is not supported on this platform.java.io.UncheckedIOException- if an I/O exception occurs.
-
contentOf
public static java.lang.String contentOf(java.net.URL url, java.nio.charset.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:
java.lang.NullPointerException- if the given charset isnull.java.io.UncheckedIOException- if an I/O exception occurs.
-
linesOf
public static java.util.List<java.lang.String> linesOf(java.net.URL url, java.nio.charset.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:
java.lang.NullPointerException- if the given charset isnull.java.io.UncheckedIOException- if an I/O exception occurs.
-
linesOf
public static java.util.List<java.lang.String> linesOf(java.net.URL url, java.lang.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:
java.lang.NullPointerException- if the given charset isnull.java.io.UncheckedIOException- if an I/O exception occurs.
-
loadContents
private static java.lang.String loadContents(java.io.InputStream stream, java.nio.charset.Charset charset) throws java.io.IOException- Throws:
java.io.IOException
-
loadLines
private static java.util.List<java.lang.String> loadLines(java.io.InputStream stream, java.nio.charset.Charset charset) throws java.io.IOException- Throws:
java.io.IOException
-
checkArgumentCharsetIsSupported
private static void checkArgumentCharsetIsSupported(java.lang.String charsetName)
-
-