public class MultiResource extends Object implements Resource, Iterable<Resource>, Iterator<Resource>, Serializable
| Constructor and Description | 
|---|
MultiResource(Collection<Resource> resources)
构造 
 | 
MultiResource(Resource... resources)
构造 
 | 
| Modifier and Type | Method and Description | 
|---|---|
MultiResource | 
add(Resource resource)
增加资源 
 | 
String | 
getName()
获取资源名,例如文件资源的资源名为文件名 
 | 
BufferedReader | 
getReader(Charset charset)
获得Reader 
 | 
InputStream | 
getStream()
获得  
InputStream | 
URL | 
getUrl()
获得解析后的 
URL,无对应URL的返回null | 
boolean | 
hasNext()  | 
Iterator<Resource> | 
iterator()  | 
Resource | 
next()  | 
byte[] | 
readBytes()
读取资源内容,读取完毕后会关闭流 
关闭流并不影响下一次读取  | 
String | 
readStr(Charset charset)
读取资源内容,读取完毕后会关闭流 
关闭流并不影响下一次读取  | 
String | 
readUtf8Str()
读取资源内容,读取完毕后会关闭流 
关闭流并不影响下一次读取  | 
void | 
remove()  | 
void | 
reset()
重置游标 
 | 
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitforEach, spliteratorforEachRemainingpublic MultiResource(Resource... resources)
resources - 资源数组public MultiResource(Collection<Resource> resources)
resources - 资源列表public InputStream getStream()
ResourceInputStreamgetStream in interface ResourceInputStreampublic BufferedReader getReader(Charset charset)
ResourcegetReader in interface Resourcecharset - 编码BufferedReaderpublic String readStr(Charset charset) throws IORuntimeException
ResourcereadStr in interface Resourcecharset - 编码IORuntimeException - 包装IOExceptionpublic String readUtf8Str() throws IORuntimeException
ResourcereadUtf8Str in interface ResourceIORuntimeException - 包装IOExceptionpublic byte[] readBytes()
                 throws IORuntimeException
ResourcereadBytes in interface ResourceIORuntimeException - 包装IOExceptionpublic void reset()
public MultiResource add(Resource resource)
resource - 资源Copyright © 2021. All rights reserved.