public class UrlResource extends Object implements Resource, Serializable
Modifier and Type | Field and Description |
---|---|
protected String |
name |
protected URL |
url |
Constructor and Description |
---|
UrlResource(File file)
Deprecated.
Please use
FileResource |
UrlResource(URI uri)
构造
|
UrlResource(URL url)
构造
|
UrlResource(URL url,
String name)
构造
|
Modifier and Type | Method and Description |
---|---|
File |
getFile()
获得File
|
String |
getName()
获取资源名,例如文件资源的资源名为文件名
|
InputStream |
getStream()
获得
InputStream |
URL |
getUrl()
获得解析后的
URL ,无对应URL的返回null |
boolean |
isModified()
检查资源是否变更
一般用于文件类资源,检查文件是否被修改过。 |
long |
size()
获取资源长度
|
String |
toString()
返回路径
|
public UrlResource(URI uri)
uri
- URIpublic UrlResource(URL url)
url
- URL@Deprecated public UrlResource(File file)
FileResource
file
- 文件路径public InputStream getStream() throws NoResourceException
Resource
InputStream
getStream
in interface Resource
InputStream
NoResourceException
public boolean isModified()
Resource
isModified
in interface Resource
public long size()
Copyright © 2024. All rights reserved.