public interface ResourceDescriptor
| 限定符和类型 | 方法和说明 |
|---|---|
boolean |
exists()
判断资源是否存在
|
String |
getDescription()
Return a description for this resource,
to be used for error output when working with the resource.
|
File |
getFile()
返回文件对象,如果对象不存在则返回
null |
String |
getFilename()
返回文件名,如果资源不存在,则返回
null |
InputStream |
getInputStream()
获取输入流,该输入流支持多次读取
|
URI |
getURI()
返回
URI资源 |
URL |
getURL()
返回
URL资源 |
long |
length()
返回资源的内容长度,如果资源不存在则返回
-1 |
boolean exists()
true,否则返回falseURL getURL() throws IOException
URL资源IOException - I/O异常URI getURI() throws IOException
URI资源IOException - I/O异常File getFile() throws IOException
nullIOException - IO异常long length()
-1String getFilename()
nullInputStream getInputStream()
InputStreamString getDescription()
Implementations are also encouraged to return this value from their toString method.
Object.toString()Copyright © 2017. All rights reserved.