public abstract class AbstractResource extends Object implements Resource
URL_PREFIX_CLASSPATH, URL_PREFIX_FILE, URL_PREFIX_JAR, URL_PREFIX_ZIP, URL_PROTOCOL_FILE, URL_PROTOCOL_JAR, URL_PROTOCOL_VFS, URL_PROTOCOL_ZIP, URL_SEPARATOR_JAR| Constructor and Description |
|---|
AbstractResource() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
exist()
是否存在
|
File |
getFile()
文件对象.
|
String |
getFileName()
文件名(不包含路径)
|
String |
getPath()
Deprecated.
replaced by
getRelativePathName() |
String |
getRelativePathName()
代表 Resource 名称,默认是 url/file (包含路径)
|
URI |
getURI()
URI 对象.
|
URL |
getURL()
URL 对象.
|
boolean |
isDirectory()
是否是一个目录
|
boolean |
isFile()
是否是一个文件
|
long |
lastModified()
最后修改时间.
|
long |
length()
文件大小 (byte 长度).
|
void |
setPath(String path)
Deprecated.
replaced by
setRelativePathName(String) |
void |
setRelativePathName(String relativePathName) |
byte[] |
toByteArray()
获取文件内容.
|
char[] |
toCharArray(Charset charset)
获取文件内容.
|
String |
toString(Charset charset)
获取文件内容.
|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitopenStreampublic void setRelativePathName(String relativePathName)
setRelativePathName in interface Resourcepublic String getRelativePathName()
ResourcegetRelativePathName in interface Resource@Deprecated public void setPath(String path)
setRelativePathName(String)@Deprecated public String getPath()
getRelativePathName()public byte[] toByteArray()
throws ResourceNotFoundException
ResourcetoByteArray in interface ResourceResourceNotFoundExceptionpublic char[] toCharArray(Charset charset) throws ResourceNotFoundException
ResourcetoCharArray in interface ResourceResourceNotFoundExceptionpublic String toString(Charset charset) throws ResourceNotFoundException
ResourcetoString in interface ResourceResourceNotFoundExceptionpublic File getFile() throws UnsupportedOperationException
ResourcegetFile in interface ResourceUnsupportedOperationExceptionpublic URI getURI() throws UnsupportedOperationException
ResourcegetURI in interface ResourceUnsupportedOperationExceptionpublic URL getURL() throws UnsupportedOperationException
ResourcegetURL in interface ResourceUnsupportedOperationExceptionpublic String getFileName()
ResourcegetFileName in interface Resourcepublic boolean exist()
Resourcepublic boolean isDirectory()
ResourceisDirectory in interface Resourcepublic boolean isFile()
Resourcepublic long length()
Resourcepublic long lastModified()
ResourcelastModified in interface ResourceCopyright © 2016 jetbrick. All rights reserved.