public final class CombinedResourceInputStream extends InputStream
This InputStream
implementation takes care that all in the constructor given resources are been read in
sequence.
Constructor and Description |
---|
CombinedResourceInputStream(Set<Resource> resources)
Creates an instance of
CombinedResourceInputStream based on the given resources. |
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the
InputStream of each resource. |
int |
read()
For each resource, read until its
InputStream.read() returns -1 and then iterate to the
InputStream of the next resource, if any available, else return -1 . |
int |
read(byte[] b,
int offset,
int length)
For each resource, read until its
InputStream.read() returns -1 and then iterate to the
InputStream of the next resource, if any available, else return -1 . |
available, mark, markSupported, read, reset, skip
public CombinedResourceInputStream(Set<Resource> resources) throws IOException
CombinedResourceInputStream
based on the given resources. For each resource, the
InputStream
will be obtained and hold in an iterable collection.resources
- The resources to be read.IOException
- If something fails at I/O level.public int read() throws IOException
InputStream.read()
returns -1
and then iterate to the
InputStream
of the next resource, if any available, else return -1
.read
in class InputStream
IOException
public int read(byte[] b, int offset, int length) throws IOException
InputStream.read()
returns -1
and then iterate to the
InputStream
of the next resource, if any available, else return -1
.read
in class InputStream
IOException
public void close() throws IOException
InputStream
of each resource. Whenever the InputStream.close()
throws an
IOException
for the first time, it will be caught and be thrown after all resources have been closed.
Any IOException
which is thrown by a subsequent close will be ignored by design.close
in interface Closeable
close
in interface AutoCloseable
close
in class InputStream
IOException
Copyright © 2012–2020 OmniFaces. All rights reserved.