@ThreadSafety(level=NOT_THREADSAFE) public final class AggregateInputStream extends java.io.InputStream
Constructor and Description |
---|
AggregateInputStream(boolean ensureBlankLinesBetweenFiles,
java.io.File... files)
Creates a new aggregate input stream that will read data from the specified
files.
|
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.
|
Modifier and Type | Method and Description |
---|---|
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.
|
public AggregateInputStream(@NotNull java.io.InputStream... inputStreams)
inputStreams
- The input streams to be used by this aggregate input
stream. It must not be null
.public AggregateInputStream(@NotNull 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(@NotNull 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.public AggregateInputStream(boolean ensureBlankLinesBetweenFiles, @NotNull java.io.File... files) throws java.io.IOException
ensureBlankLinesBetweenFiles
- Indicates whether to ensure that
there is at least one completely
blank line between files. This may
be useful when blank lines are
used as delimiters (for example, when
reading LDIF data), there is a chance
that the files may not end with blank
lines, and the inclusion of extra
blank lines between files will not
cause any harm.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.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(@NotNull 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(@NotNull 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 interface java.lang.AutoCloseable
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.