net.sf.mmm.util.io.base
Class AbstractByteArray
java.lang.Object
net.sf.mmm.util.io.base.AbstractByteArray
- All Implemented Interfaces:
- ByteArray, ByteProvider
- Direct Known Subclasses:
- ByteArrayImpl, DetectorStreamBufferImpl.CurrentByteArray
public abstract class AbstractByteArray
- extends Object
- implements ByteArray
This is the abstract base implementation of the ByteArray
interface.
- Since:
- 1.1.0
- Author:
- Joerg Hohwiller (hohwille at users.sourceforge.net)
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
AbstractByteArray
public AbstractByteArray()
checkSubArray
protected void checkSubArray(int minimum,
int maximum)
- This method checks that the given
minimum
and
maximum
are valid for createSubArray(int, int)
.
- Parameters:
minimum
- is the new minimumIndex
.maximum
- is the new maximumIndex
.
createSubArray
public ByteArray 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.
- Specified by:
createSubArray
in interface ByteArray
- Parameters:
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
.
- Returns:
- a new
ByteArray
with the given indices.
getBytesAvailable
public int getBytesAvailable()
- This method gets the number of bytes available in this array. In other
words this method returns
ByteArray.getMaximumIndex()
- ByteArray.getCurrentIndex()
+ 1
.
- Specified by:
getBytesAvailable
in interface ByteArray
- Specified by:
getBytesAvailable
in interface ByteProvider
- Returns:
- the bytes left in this array.
Copyright © 2001-2010 mmm-Team. All Rights Reserved.