URL parameters, they are usually not appropriate for HTTP or other
non-classpath resources.
| Modifier and Type | Class and Description |
|---|---|
| private static class | Resources.UrlByteSource
A byte source that reads from a URL using |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public static ByteSource | |
| public static CharSource | asCharSource(URL url, Charset charset)
Returns a |
| public static void | copy(URL
the URL to read from from, OutputStream the output stream to)Copies all bytes from a URL to an output stream. |
| public static URL | getResource(String resourceName)
Returns a |
| public static URL | getResource(Class<?> contextClass, String resourceName)
Given a |
| public static <T extends @Nullable Object> T | Returns: the output of processing the linesthe URL to read from url, Charset the charset used to decode the input stream; see charset, LineProcessor<T> Charsets for helpful
predefined constantsthe LineProcessor to use to handle the lines callback)Streams lines from a URL, stopping when our callback returns false, or we have read all of the lines. |
| public static List | |
| public static byte[] | Returns: a byte array containing all the bytes from the URLthe URL to read from url)Reads all bytes from a URL into a byte array. |
| public static String |
| Resources | back to summary |
|---|---|
| private Resources() | |
| asByteSource | back to summary |
|---|---|
| public static ByteSource asByteSource(URL url) Returns a
| |
| asCharSource | back to summary |
|---|---|
| public static CharSource asCharSource(URL url, Charset charset) Returns a
| |
| copy | back to summary |
|---|---|
| public static void copy(URL from, OutputStream to) throws IOException Copies all bytes from a URL to an output stream.
| |
| getResource | back to summary |
|---|---|
| public static URL getResource(String resourceName) Returns a In the unusual case where the context class loader is null, the class loader that loaded
this class (
| |
| getResource | back to summary |
|---|---|
| public static URL getResource(Class<?> contextClass, String resourceName) Given a
| |
| readLines | back to summary |
|---|---|
| public static <T extends @Nullable Object> T readLines(URL url, Charset charset, LineProcessor<T> callback) throws IOException Streams lines from a URL, stopping when our callback returns false, or we have read all of the lines.
| |
| readLines | back to summary |
|---|---|
| public static List Reads all of the lines from a URL. The lines do not include line-termination characters, but do include other leading and trailing whitespace. This method returns a mutable | |
| toByteArray | back to summary |
|---|---|
| public static byte[] toByteArray(URL url) throws IOException Reads all bytes from a URL into a byte array.
| |
| toString | back to summary |
|---|---|
| public static String toString(URL url, Charset charset) throws IOException Reads all characters from a URL into a
| |
URL#openStream().
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public InputStream | openStream()
Implements abstract com. InputStream for reading from this source.
|
| public String |
| url | back to summary |
|---|---|
| private final URL url | |
| UrlByteSource | back to summary |
|---|---|
| private UrlByteSource(URL url) | |
| openStream | back to summary |
|---|---|
| public InputStream openStream() throws IOException Implements abstract com. Doc from com. Opens a new The caller is responsible for ensuring that the returned stream is closed.
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object. | |