public class UrlResource extends AbstractFileResolvingResource
Resource implementation for java.net.URL
locators.
Obviously supports resolution as URL, and also as File in case of
the "file:" protocol.
Constructor and description |
---|
UrlResource(URL url) Create a new UrlResource. |
UrlResource(URI uri) Create a new UrlResource. |
UrlResource(String path) Create a new UrlResource. |
Type Params | Return Type | Name and description |
---|---|---|
|
public Resource |
createRelative(String relativePath) This implementation creates a UrlResource, applying the given path relative to the path of the underlying URL of this resource descriptor. |
|
public boolean |
equals(Object obj) This implementation compares the underlying URL references. |
|
public String |
getDescription() This implementation returns a description that includes the URL. |
|
public File |
getFile() This implementation returns a File reference for the underlying URL/URI, provided that it refers to a file in the file system. |
|
public String |
getFilename() This implementation returns the name of the file that this URL refers to. |
|
public InputStream |
getInputStream() This implementation opens an InputStream for the given URL. |
|
public URI |
getURI() This implementation returns the underlying URI directly, if possible. |
|
public URL |
getURL() This implementation returns the underlying URL reference. |
|
public int |
hashCode() This implementation returns the hash code of the underlying URL reference. |
|
public String |
toString() |
Methods inherited from class | Name |
---|---|
class AbstractFileResolvingResource |
contentLength, exists, getFile, getFile, getFileForLastModifiedCheck, isReadable, lastModified |
Create a new UrlResource.
url
- a URLCreate a new UrlResource.
uri
- a URICreate a new UrlResource.
path
- a URL pathThis implementation creates a UrlResource, applying the given path relative to the path of the underlying URL of this resource descriptor.
This implementation compares the underlying URL references.
This implementation returns a description that includes the URL.
This implementation returns a File reference for the underlying URL/URI, provided that it refers to a file in the file system.
This implementation returns the name of the file that this URL refers to.
This implementation opens an InputStream for the given URL.
It sets the "UseCaches" flag to false
,
mainly to avoid jar file locking on Windows.
This implementation returns the underlying URI directly, if possible.
This implementation returns the underlying URL reference.
This implementation returns the hash code of the underlying URL reference.