private static final class ByteSource.ConcatenatedByteSource extends ByteSource
Modifier and Type | Field and Description |
---|---|
private java.lang.Iterable<? extends ByteSource> |
sources |
Constructor and Description |
---|
ConcatenatedByteSource(java.lang.Iterable<? extends ByteSource> sources) |
Modifier and Type | Method and Description |
---|---|
boolean |
isEmpty()
Returns whether the source has zero bytes.
|
java.io.InputStream |
openStream()
Opens a new
InputStream for reading from this source. |
long |
size()
Returns the size of this source in bytes.
|
java.lang.String |
toString() |
asCharSource, concat, concat, concat, contentEquals, copyTo, copyTo, empty, hash, openBufferedStream, read, read, slice, wrap
private final java.lang.Iterable<? extends ByteSource> sources
ConcatenatedByteSource(java.lang.Iterable<? extends ByteSource> sources)
public java.io.InputStream openStream() throws java.io.IOException
ByteSource
InputStream
for reading from this source. This method should return a new,
independent stream each time it is called.
The caller is responsible for ensuring that the returned stream is closed.
openStream
in class ByteSource
java.io.IOException
- if an I/O error occurs in the process of opening the streampublic boolean isEmpty() throws java.io.IOException
ByteSource
isEmpty
in class ByteSource
java.io.IOException
- if an I/O error occurspublic long size() throws java.io.IOException
ByteSource
skip
, if possible)
to the end of the stream and return the total number of bytes that were read.
For some sources, such as a file, this method may use a more efficient implementation. Note that in such cases, it is possible that this method will return a different number of bytes than would be returned by reading all of the bytes (for example, some special files may return a size of 0 despite actually having content when read).
In either case, if this is a mutable source such as a file, the size it returns may not be the same number of bytes a subsequent read would return.
size
in class ByteSource
java.io.IOException
- if an I/O error occurs in the process of reading the size of this sourcepublic java.lang.String toString()
toString
in class java.lang.Object