public class SharedByteArrayInputStream extends ByteArrayInputStream implements SharedInputStream
Modifier and Type | Field and Description |
---|---|
protected int |
start
Position within shared buffer that this stream starts at.
|
buf, count, mark, pos
Constructor and Description |
---|
SharedByteArrayInputStream(byte[] buf)
Create a SharedByteArrayInputStream representing the entire
byte array.
|
SharedByteArrayInputStream(byte[] buf,
int offset,
int length)
Create a SharedByteArrayInputStream representing the part
of the byte array from
offset for length
bytes. |
Modifier and Type | Method and Description |
---|---|
long |
getPosition()
Return the current position in the InputStream, as an
offset from the beginning of the InputStream.
|
InputStream |
newStream(long start,
long end)
Return a new InputStream representing a subset of the data
from this InputStream, starting at
start (inclusive)
up to end (exclusive). |
available, close, mark, markSupported, read, read, reset, skip
read
public SharedByteArrayInputStream(byte[] buf)
buf
- the byte arraypublic SharedByteArrayInputStream(byte[] buf, int offset, int length)
offset
for length
bytes.buf
- the byte arrayoffset
- offset in byte array to first byte to includelength
- number of bytes to includepublic long getPosition()
getPosition
in interface SharedInputStream
public InputStream newStream(long start, long end)
start
(inclusive)
up to end
(exclusive). start
must be
non-negative. If end
is -1, the new stream ends
at the same place as this stream. The returned InputStream
will also implement the SharedInputStream interface.newStream
in interface SharedInputStream
start
- the starting positionend
- the ending position + 1Copyright © 2019 Eclipse Foundation.
Use is subject to license terms.