ist.palcom.base
Class ByteArray

java.lang.Object
  extended by ist.palcom.base.Object
      extended by ist.palcom.base.ByteArray

public class ByteArray
extends Object

ByteArray is a system class representing arrays of byte values. The bytes are represented efficiently by the VM. The byte values are manipulated as small Integer values when reading and writing values. The index of the first element is 0. The size of a ByteArray is fixed at creation time.


Constructor Summary
ByteArray(Size size)
          Creates a ByteArray with given size.
 
Method Summary
 int at(int position)
          Returns byte at specified position.
 void at(int position, int value)
          Replaces byte at specified position with new value.
 void doIndexes(Block block)
          Evaluates the block with all legal indexes of this ByteArray.
 length length()
          Returns the number of bytes in this ByteArray.
 void putAll(Block block)
          Store the result of evaluating the specified block at all positions in this ByteArray.
 void putAllIndexes(Block block)
          Store the result of evaluating the specified block at all positions with the index as argument in this ByteArray.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ByteArray

public ByteArray(Size size)
Creates a ByteArray with given size.

Parameters:
size - Size of new ByteArray.
Method Detail

putAllIndexes

public void putAllIndexes(Block block)
Store the result of evaluating the specified block at all positions with the index as argument in this ByteArray.

Parameters:
block - Block block to evaluate with index as argument.

putAll

public void putAll(Block block)
Store the result of evaluating the specified block at all positions in this ByteArray.

Parameters:
block - Block block to evaluate.

length

public length length()
Returns the number of bytes in this ByteArray.

Returns:
length of this ByteArray.

doIndexes

public void doIndexes(Block block)
Evaluates the block with all legal indexes of this ByteArray.

Parameters:
block - Block block to evaluate with legal indexes of this ByteArray.

at

public void at(int position,
               int value)
Replaces byte at specified position with new value.

Parameters:
position - int index of byte to replace with new value.
value - int byte value to store at specified position.

at

public int at(int position)
Returns byte at specified position.

Parameters:
position - int index of byte to return.
Returns:
int byte value at specified position.