public class URLs
extends java.lang.Object
Constructor and Description |
---|
URLs() |
Modifier and Type | Method and Description |
---|---|
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.
|
static java.lang.String |
contentOf(java.net.URL url,
java.lang.String charsetName)
Loads the text content of a URL into a character string.
|
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.
|
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.
|
private static java.lang.String |
loadContents(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) |
public static java.lang.String contentOf(java.net.URL url, java.lang.String charsetName)
url
- the URL.charsetName
- the name of the character set to use.java.lang.IllegalArgumentException
- if the given character set is not supported on this platform.RuntimeIOException
- if an I/O exception occurs.public static java.lang.String contentOf(java.net.URL url, java.nio.charset.Charset charset)
url
- the URL.charset
- the character set to use.java.lang.NullPointerException
- if the given charset is null
.RuntimeIOException
- if an I/O exception occurs.public static java.util.List<java.lang.String> linesOf(java.net.URL url, java.nio.charset.Charset charset)
url
- the URL.charset
- the character set to use.java.lang.NullPointerException
- if the given charset is null
.RuntimeIOException
- if an I/O exception occurs.public static java.util.List<java.lang.String> linesOf(java.net.URL url, java.lang.String charsetName)
url
- the URL.charsetName
- the name of the character set to use.java.lang.NullPointerException
- if the given charset is null
.RuntimeIOException
- if an I/O exception occurs.private static java.lang.String loadContents(java.io.InputStream stream, java.nio.charset.Charset charset) throws java.io.IOException
java.io.IOException
private static java.util.List<java.lang.String> loadLines(java.io.InputStream stream, java.nio.charset.Charset charset) throws java.io.IOException
java.io.IOException