java.lang.Object
java.io.InputStream
org.omnifaces.resourcehandler.CombinedResourceInputStream
- All Implemented Interfaces:
Closeable,AutoCloseable
This InputStream implementation takes care that all in the constructor given resources are been read in
sequence.
- Author:
- Bauke Scholtz
-
Constructor Summary
ConstructorsConstructorDescriptionCombinedResourceInputStream(Set<Resource> resources) Creates an instance ofCombinedResourceInputStreambased on the given resources. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Closes theInputStreamof each resource.intread()For each resource, read until itsInputStream.read()returns-1and then iterate to theInputStreamof the next resource, if any available, else return-1.intread(byte[] b, int offset, int length) For each resource, read until itsInputStream.read()returns-1and then iterate to theInputStreamof the next resource, if any available, else return-1.Methods inherited from class java.io.InputStream
available, mark, markSupported, nullInputStream, read, readAllBytes, readNBytes, readNBytes, reset, skip, skipNBytes, transferTo
-
Constructor Details
-
CombinedResourceInputStream
Creates an instance ofCombinedResourceInputStreambased on the given resources. For each resource, theInputStreamwill be obtained and hold in an iterable collection.- Parameters:
resources- The resources to be read.- Throws:
IOException- If something fails at I/O level.
-
-
Method Details
-
read
For each resource, read until itsInputStream.read()returns-1and then iterate to theInputStreamof the next resource, if any available, else return-1.- Specified by:
readin classInputStream- Throws:
IOException
-
read
For each resource, read until itsInputStream.read()returns-1and then iterate to theInputStreamof the next resource, if any available, else return-1.- Overrides:
readin classInputStream- Throws:
IOException
-
close
Closes theInputStreamof each resource. Whenever theInputStream.close()throws anIOExceptionfor the first time, it will be caught and be thrown after all resources have been closed. AnyIOExceptionwhich is thrown by a subsequent close will be ignored by design.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classInputStream- Throws:
IOException
-