public class UrlResource extends VirtualResource
| Modifier and Type | Field and Description |
|---|---|
static URL |
PLACEHOLDER_URL |
UTF8| Constructor and Description |
|---|
UrlResource() |
UrlResource(URL url) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
exists()
Returns true if the resource exists; if a stream to the content of the file may be opened.
|
Resource |
forLocale(Locale locale)
Returns a localized version of the resource.
|
InputStream |
openStream()
Opens a stream to the content of the resource, or returns null if the resource does not exist.
|
String |
toString() |
URL |
toURL()
Returns the URL for the resource, or null if it does not exist.
|
forFile, getFile, getFolder, getPath, isVirtual, toInputStream, toInputStream, withExtensionpublic static final URL PLACEHOLDER_URL
public UrlResource()
public UrlResource(URL url)
public InputStream openStream() throws IOException
ResourceBufferedInputStream.IOExceptionpublic URL toURL()
ResourcetoURL in interface ResourcetoURL in class VirtualResourcepublic boolean exists()
ResourceResource.toURL() returns a non-null value. Starting in release 5.3.4, the result of this is cached.
Starting in 5.4, some "virtual resources", may return true even though Resource.toURL() returns null.exists in interface Resourceexists in class VirtualResourcepublic Resource forLocale(Locale locale)
ResourceforLocale in interface ResourceforLocale in class VirtualResource5.6.4 - Copyright © 2003-2021 The Apache Software Foundation.