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, withExtension
public static final URL PLACEHOLDER_URL
public UrlResource()
public UrlResource(URL url)
public InputStream openStream() throws IOException
Resource
BufferedInputStream
.IOException
public URL toURL()
Resource
toURL
in interface Resource
toURL
in class VirtualResource
public boolean exists()
Resource
Resource.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 Resource
exists
in class VirtualResource
public Resource forLocale(Locale locale)
Resource
forLocale
in interface Resource
forLocale
in class VirtualResource
5.6.3 - Copyright © 2003-2021 The Apache Software Foundation.