public class InputStreamResource extends Object implements Resource, Serializable
InputStream
的资源获取器构造器和说明 |
---|
InputStreamResource(InputStream in)
构造
|
InputStreamResource(InputStream in,
String name)
构造
|
限定符和类型 | 方法和说明 |
---|---|
String |
getName()
获取资源名,例如文件资源的资源名为文件名
|
BufferedReader |
getReader(Charset charset)
获得Reader
|
InputStream |
getStream()
获得
InputStream |
URL |
getUrl()
获得解析后的
URL |
byte[] |
readBytes()
读取资源内容,读取完毕后会关闭流
关闭流并不影响下一次读取 |
String |
readStr(Charset charset)
读取资源内容,读取完毕后会关闭流
关闭流并不影响下一次读取 |
String |
readUtf8Str()
读取资源内容,读取完毕后会关闭流
关闭流并不影响下一次读取 |
public InputStreamResource(InputStream in)
in
- InputStream
public InputStreamResource(InputStream in, String name)
in
- InputStream
name
- 资源名称public InputStream getStream()
Resource
InputStream
getStream
在接口中 Resource
InputStream
public BufferedReader getReader(Charset charset)
Resource
getReader
在接口中 Resource
charset
- 编码BufferedReader
public String readStr(Charset charset) throws IORuntimeException
Resource
readStr
在接口中 Resource
charset
- 编码IORuntimeException
- 包装IOException
public String readUtf8Str() throws IORuntimeException
Resource
readUtf8Str
在接口中 Resource
IORuntimeException
- 包装IOExceptionpublic byte[] readBytes() throws IORuntimeException
Resource
readBytes
在接口中 Resource
IORuntimeException
- 包装IOExceptionCopyright © 2020. All rights reserved.