private final class ByteSource.SlicedByteSource extends ByteSource
| Modifier and Type | Field and Description |
|---|---|
private long |
length |
private long |
offset |
| Modifier | Constructor and Description |
|---|---|
private |
SlicedByteSource(long offset,
long length) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
isEmpty()
Returns whether the source has zero bytes.
|
java.io.InputStream |
openBufferedStream()
Opens a new buffered
InputStream for reading from this source. |
java.io.InputStream |
openStream()
Opens a new
InputStream for reading from this source. |
ByteSource |
slice(long offset,
long length)
Returns a view of a slice of this byte source that is at most
length bytes long
starting at the given offset. |
private java.io.InputStream |
sliceStream(java.io.InputStream in) |
java.lang.String |
toString() |
asCharSource, concat, concat, concat, contentEquals, copyTo, copyTo, empty, hash, read, read, size, wrappublic java.io.InputStream openStream()
throws java.io.IOException
ByteSourceInputStream 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 ByteSourcejava.io.IOException - if an I/O error occurs in the process of opening the streampublic java.io.InputStream openBufferedStream()
throws java.io.IOException
ByteSourceInputStream for reading from this source. The returned stream is
not required to be a BufferedInputStream in order to allow implementations to simply
delegate to ByteSource.openStream() when the stream returned by that method does not benefit
from additional buffering (for example, a ByteArrayInputStream). 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.
openBufferedStream in class ByteSourcejava.io.IOException - if an I/O error occurs in the process of opening the streamprivate java.io.InputStream sliceStream(java.io.InputStream in)
throws java.io.IOException
java.io.IOExceptionpublic ByteSource slice(long offset, long length)
ByteSourcelength bytes long
starting at the given offset.slice in class ByteSourcepublic boolean isEmpty()
throws java.io.IOException
ByteSourceisEmpty in class ByteSourcejava.io.IOException - if an I/O error occurspublic java.lang.String toString()
toString in class java.lang.Object