public interface Resource
| Modifier and Type | Method and Description |
|---|---|
String |
getName()
获取资源名,例如文件资源的资源名为文件名
|
BufferedReader |
getReader(Charset charset)
获得Reader
|
InputStream |
getStream()
获得
InputStream |
URL |
getUrl()
获得解析后的
URL |
byte[] |
readBytes()
读取资源内容,读取完毕后会关闭流
关闭流并不影响下一次读取
|
String |
readString(Charset charset)
读取资源内容,读取完毕后会关闭流
关闭流并不影响下一次读取
|
default void |
writeTo(OutputStream out)
将资源内容写出到流,不关闭输出流,但是关闭资源流
|
String getName()
InputStream getStream()
InputStreamInputStreamBufferedReader getReader(Charset charset)
charset - 编码BufferedReaderString readString(Charset charset) throws InstrumentException
charset - 编码InstrumentException - 包装IOExceptionbyte[] readBytes()
throws InstrumentException
InstrumentException - 包装IOExceptiondefault void writeTo(OutputStream out) throws InstrumentException
out - 输出流InstrumentException - IO异常Copyright © 2020. All rights reserved.