public interface Resource
| Modifier and Type | Field and Description |
|---|---|
static String |
URL_PREFIX_CLASSPATH |
static String |
URL_PREFIX_FILE |
static String |
URL_PREFIX_JAR |
static String |
URL_PREFIX_ZIP |
static String |
URL_PROTOCOL_FILE |
static String |
URL_PROTOCOL_JAR |
static String |
URL_PROTOCOL_VFS |
static String |
URL_PROTOCOL_ZIP |
static String |
URL_SEPARATOR_JAR |
| 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 长度).
|
InputStream |
openStream()
打开文件输入流.
|
void |
setRelativePathName(String relativePathName) |
byte[] |
toByteArray()
获取文件内容.
|
char[] |
toCharArray(Charset charset)
获取文件内容.
|
String |
toString(Charset charset)
获取文件内容.
|
static final String URL_PREFIX_CLASSPATH
static final String URL_PREFIX_FILE
static final String URL_PREFIX_JAR
static final String URL_PREFIX_ZIP
static final String URL_PROTOCOL_FILE
static final String URL_PROTOCOL_JAR
static final String URL_PROTOCOL_ZIP
static final String URL_PROTOCOL_VFS
static final String URL_SEPARATOR_JAR
String getRelativePathName()
void setRelativePathName(String relativePathName)
@Deprecated String getPath()
getRelativePathName()InputStream openStream() throws ResourceNotFoundException
ResourceNotFoundExceptionbyte[] toByteArray()
throws ResourceNotFoundException
ResourceNotFoundExceptionchar[] toCharArray(Charset charset) throws ResourceNotFoundException
ResourceNotFoundExceptionString toString(Charset charset) throws ResourceNotFoundException
ResourceNotFoundExceptionFile getFile() throws UnsupportedOperationException
UnsupportedOperationExceptionURI getURI() throws UnsupportedOperationException
UnsupportedOperationExceptionURL getURL() throws UnsupportedOperationException
UnsupportedOperationExceptionString getFileName()
boolean exist()
boolean isDirectory()
boolean isFile()
long length()
long lastModified()
Copyright © 2016 jetbrick. All rights reserved.