public class SharedByteArrayInputStream extends java.io.ByteArrayInputStream implements SharedInputStream
Modifier and Type | Field and Description |
---|---|
protected int |
start
Position within shared buffer that this stream starts at.
|
Constructor and Description |
---|
SharedByteArrayInputStream(byte[] buf)
Create a SharedByteArrayInputStream that shares the entire
buffer.
|
SharedByteArrayInputStream(byte[] buf,
int offset,
int length)
Create a SharedByteArrayInputStream using a subset of the
array data.
|
Modifier and Type | Method and Description |
---|---|
long |
getPosition()
Get the position within the output stream, adjusted by the
starting offset.
|
java.io.InputStream |
newStream(long offset,
long end)
Create a new input stream from this input stream, accessing
a subset of the data.
|
public SharedByteArrayInputStream(byte[] buf)
buf
- The input data.public SharedByteArrayInputStream(byte[] buf, int offset, int length)
buf
- The source data array.offset
- The starting offset within the array.length
- The length of data to use.public long getPosition()
getPosition
in interface SharedInputStream
public java.io.InputStream newStream(long offset, long end)
newStream
in interface SharedInputStream
offset
- The starting offset.end
- The end offset (which can be -1).