public class PooledByteArray extends ByteArrayImpl
ByteArray
that holds a pooled
byte-array
.ByteArrayPool
Modifier and Type | Field and Description |
---|---|
private int |
childCount
The number of
children created. |
private PooledByteArray |
parent
The parent that
created this array. |
private boolean |
released |
Modifier | Constructor and Description |
---|---|
|
PooledByteArray(byte[] buffer)
The constructor.
|
|
PooledByteArray(byte[] buffer,
int startIndex,
int maximumIndex)
The constructor.
|
protected |
PooledByteArray(byte[] buffer,
int startIndex,
int maximumIndex,
PooledByteArray parent)
The constructor.
|
Modifier and Type | Method and Description |
---|---|
ByteArrayImpl |
createSubArray(int minimum,
int maximum)
This method creates a new
ByteArray with the same bytes but the given
indices.ATTENTION: If the implementation is immutable and the given minimum and maximum index are
both equal to the current indices of this ByteArray this method may return the instance itself (
this ) rather than creating a new one. |
boolean |
release()
This method marks this array to be released.
|
getBytes, getCurrentIndex, getMaximumIndex, getMinimumIndex, setMaximumIndex, toString
checkSubArray, getBytesAvailable
private final PooledByteArray parent
created
this array.private int childCount
children
created.private boolean released
release()
public PooledByteArray(byte[] buffer)
buffer
- is the internal buffer
.public PooledByteArray(byte[] buffer, int startIndex, int maximumIndex)
buffer
- is the internal buffer
.startIndex
- is the current index
as well as the
minimum index
.maximumIndex
- is the maximum index
.protected PooledByteArray(byte[] buffer, int startIndex, int maximumIndex, PooledByteArray parent)
buffer
- is the internal buffer
.startIndex
- is the current index
as well as the
minimum index
.maximumIndex
- is the maximum index
.parent
- is the parent that created
this array.public ByteArrayImpl createSubArray(int minimum, int maximum)
ByteArray
with the same bytes
but the given
indices.minimum
and maximum
index are
both equal to the current indices of this ByteArray
this method may return the instance itself (
this
) rather than creating a new one.createSubArray
in interface ByteArray
createSubArray
in class ByteArrayImpl
minimum
- is the minimumIndex
and the currentIndex
for the new ByteArray
. It has to be greater or equal to the
minimumIndex
of this
ByteArray
.maximum
- is the maximumIndex
for the new ByteArray
.ByteArray
with the given indices.public boolean release()
true
if this array can be released, false
if there are references left
that have to be released before.Copyright © 2001–2014 mmm-Team. All rights reserved.