public class UrlResource extends AbstractResource
| 构造器和说明 |
|---|
UrlResource(java.lang.String path)
Create a new UrlResource.
|
UrlResource(java.net.URI uri)
Create a new UrlResource.
|
UrlResource(java.net.URL url)
Create a new UrlResource.
|
| 限定符和类型 | 方法和说明 |
|---|---|
boolean |
equals(java.lang.Object obj) |
java.io.File |
getFile()
This implementation returns a File reference for the underlying URL/URI,
provided that it refers to a file in the file system.
|
protected java.io.File |
getFile2Check()
determines the underlying File (or jar file, in case of a resource in a jar/zip).
|
java.io.InputStream |
getInputStream()
opens an InputStream for the given URL.
|
java.io.OutputStream |
getOutputStream()
opens an OutputStream for the given URL.
|
java.lang.String |
getResourceLocation() |
java.lang.String |
getResourceName()
returns the name of the file that this URL refers to.
|
java.net.URI |
getURI()
This implementation returns the underlying URI directly,
if possible.
|
java.net.URL |
getURL() |
int |
hashCode() |
exists, isReadable, lastModified, toStringpublic UrlResource(java.net.URL url)
url - a URLpublic UrlResource(java.net.URI uri)
throws java.net.MalformedURLException
uri - a URIjava.net.MalformedURLException - if the given URL path is not validpublic UrlResource(java.lang.String path)
throws java.net.MalformedURLException
path - a URL pathjava.net.MalformedURLException - if the given URL path is not validpublic java.io.InputStream getInputStream()
throws java.io.IOException
false,
mainly to avoid jar file locking on Windows.java.io.IOExceptionpublic java.net.URL getURL()
throws java.io.IOException
java.io.IOExceptionpublic java.net.URI getURI()
throws java.io.IOException
getURI 在接口中 ResourcegetURI 在类中 AbstractResourcejava.io.IOExceptionpublic java.io.File getFile()
throws java.io.IOException
java.io.IOExceptionprotected java.io.File getFile2Check()
throws java.io.IOException
getFile2Check 在类中 AbstractResourcenull)java.io.IOException - if the resource cannot be resolved as absolute
file path, i.e. if the resource is not available in a file systempublic java.lang.String getResourceName()
public java.lang.String getResourceLocation()
public boolean equals(java.lang.Object obj)
equals 在类中 java.lang.Objectpublic int hashCode()
hashCode 在类中 java.lang.Objectpublic java.io.OutputStream getOutputStream()
throws java.io.IOException
false,
mainly to avoid jar file locking on Windows.java.io.IOExceptionCopyright © 2024. All Rights Reserved.