net.sf.mmm.util.io.impl
Class DetectorStreamBufferImpl.CurrentByteArray

java.lang.Object
  extended by net.sf.mmm.util.io.base.AbstractByteArray
      extended by net.sf.mmm.util.io.impl.DetectorStreamBufferImpl.CurrentByteArray
All Implemented Interfaces:
ByteArray, ByteProvider
Enclosing class:
DetectorStreamBufferImpl

protected class DetectorStreamBufferImpl.CurrentByteArray
extends AbstractByteArray

This inner class is a view on the current ByteArray.

See Also:
DetectorStreamBufferImpl.getByteArray(int)

Constructor Summary
protected DetectorStreamBufferImpl.CurrentByteArray()
           
 
Method Summary
 byte[] getBytes()
          This method gets the underlying byte-array of this buffer.
 int getBytesAvailable()
          This method gets the number of bytes available in this array.
 int getCurrentIndex()
          This method gets the offset in the byte array.
 int getMaximumIndex()
          This method gets the maximum index in the buffer.
 int getMinimumIndex()
          This method gets the minimum index where to start reading in the byte array.
 
Methods inherited from class net.sf.mmm.util.io.base.AbstractByteArray
checkSubArray, createSubArray
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DetectorStreamBufferImpl.CurrentByteArray

protected DetectorStreamBufferImpl.CurrentByteArray()
Method Detail

getBytes

public byte[] getBytes()
This method gets the underlying byte-array of this buffer. You are only permitted to read the content from minimumIndex (typically currentIndex to maximumIndex. Only the creator of this object may modify this array.

Returns:
the buffer
See Also:
ByteArray.getCurrentIndex(), ByteArray.getMaximumIndex()

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
Overrides:
getBytesAvailable in class AbstractByteArray
Returns:
the bytes left in this array.

getMinimumIndex

public int getMinimumIndex()
This method gets the minimum index where to start reading in the byte array. It will be in the range from 0 to maximumIndex + 1. This is typically the same as the current index. However a mutable variant of a ByteArray may allow to modify (increase) the current-index. The value returned by this method can NOT be modified.

Returns:
the minimum index.

getCurrentIndex

public int getCurrentIndex()
This method gets the offset in the byte array. It will be in the range from 0 to maximumIndex + 1.

Returns:
the offset in the byte array.

getMaximumIndex

public int getMaximumIndex()
This method gets the maximum index in the buffer. It will be in the range from -1 to ByteArray.getBytes().length - 1.
A negative value (-1) indicates that the buffer does NOT contain data (payload).

Returns:
the maximumIndex


Copyright © 2001-2010 mmm-Team. All Rights Reserved.