|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.io.InputStream
com.unboundid.util.AggregateInputStream
@ThreadSafety(level=NOT_THREADSAFE) public final class AggregateInputStream
This class provides an input stream implementation that can aggregate multiple input streams. When reading data from this input stream, it will read from the first input stream until the end of it is reached, at point it will close it and start reading from the next one, and so on until all input streams have been exhausted. Closing the aggregate input stream will cause all remaining input streams to be closed.
Constructor Summary | |
---|---|
AggregateInputStream(java.util.Collection<? extends java.io.InputStream> inputStreams)
Creates a new aggregate input stream that will use the provided set of input streams. |
|
AggregateInputStream(java.io.File... files)
Creates a new aggregate input stream that will read data from the specified files. |
|
AggregateInputStream(java.io.InputStream... inputStreams)
Creates a new aggregate input stream that will use the provided set of input streams. |
Method Summary | |
---|---|
int |
available()
Retrieves an estimate of the number of bytes that can be read without blocking. |
void |
close()
Closes this input stream. |
void |
mark(int readLimit)
Marks the current position in the input stream. |
boolean |
markSupported()
Indicates whether this input stream supports the use of the mark
and reset methods. |
int |
read()
Reads the next byte of data from the current active input stream, switching to the next input stream in the set if appropriate. |
int |
read(byte[] b)
Reads data from the current active input stream into the provided array, switching to the next input stream in the set if appropriate. |
int |
read(byte[] b,
int off,
int len)
Reads data from the current active input stream into the provided array, switching to the next input stream in the set if appropriate. |
void |
reset()
Attempts to reset the position of this input stream to the mark location. |
long |
skip(long n)
Attempts to skip and discard up to the specified number of bytes from the input stream. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AggregateInputStream(java.io.InputStream... inputStreams)
inputStreams
- The input streams to be used by this aggregate input
stream. It must not be null
.public AggregateInputStream(java.util.Collection<? extends java.io.InputStream> inputStreams)
inputStreams
- The input streams to be used by this aggregate input
stream. It must not be null
.public AggregateInputStream(java.io.File... files) throws java.io.IOException
files
- The set of files to be read by this aggregate input stream.
It must not be null
.
java.io.IOException
- If a problem is encountered while attempting to
create input streams for the provided files.Method Detail |
---|
public int read() throws java.io.IOException
read
in class java.io.InputStream
java.io.IOException
- If a problem is encountered while attempting to read
data from an input stream.public int read(byte[] b) throws java.io.IOException
read
in class java.io.InputStream
b
- The array into which the data read should be placed, starting
with an index of zero. It must not be null
.
java.io.IOException
- If a problem is encountered while attempting to read
data from an input stream.public int read(byte[] b, int off, int len) throws java.io.IOException
read
in class java.io.InputStream
b
- The array into which the data read should be placed. It must
not be null
.off
- The position in the array at which to start writing data.len
- The maximum number of bytes that may be read.
java.io.IOException
- If a problem is encountered while attempting to read
data from an input stream.public long skip(long n) throws java.io.IOException
skip
in class java.io.InputStream
n
- The number of bytes to attempt to skip.
java.io.IOException
- If a problem is encountered while attempting to skip
data from the input stream.public int available() throws java.io.IOException
available
in class java.io.InputStream
java.io.IOException
- If a problem is encountered while attempting to make
the determination.public boolean markSupported()
mark
and reset
methods. This implementation does not support that
capability.
markSupported
in class java.io.InputStream
false
to indicate that this input stream implementation
does not support the use of mark
and reset
.public void mark(int readLimit)
mark
in class java.io.InputStream
readLimit
- The maximum number of bytes that the caller may wish to
read before being able to reset the stream.public void reset() throws java.io.IOException
mark
and reset
functionality, so this method will always throw an exception.
reset
in class java.io.InputStream
java.io.IOException
- To indicate that reset is not supported.public void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in class java.io.InputStream
java.io.IOException
- If an exception was encountered while attempting to
close any of the associated streams. Note that even
if an exception is encountered, an attempt will be
made to close all streams.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |