A byte array using fast "alchemy-memory" for data storage.

Constructor

new (size:Int, ?name:String)

Creates a byte array capable of storing a total of size bytes.

Variables

read onlysize:Int

The size measured in bytes.

Methods

clone ():ByteMemory

Creates a deep copy of this object.

inline get (i:Int):Int

Returns the byte at index i.

inline getAddr (i:Int):Int

Returns the memory byte offset for the byte at index i.

resize (newSize:Int):Void

Adjusts the size of this object so it's capable of storing newSize bytes.

inline set (i:Int, x:Int):Void

Replaces the byte at the index i with the byte x.

setAll (x:Int):ByteMemory

Sets all bytes to the value x.

inline swap (i:Int, j:Int):Void

Swaps the byte at the index i with the byte at the index j.

toString ():String

Prints out all elements.

Static methods

staticofArray (input:Array<Int>, ?min:Int, ?max:Int):ByteMemory

Converts input in the range [min, max] to a ByteMemory object. If no range is specified, all input bytes are copied.

staticofByteArray (input:ByteArray, ?min:Int, ?max:Int):ByteMemory

Converts input in the range [min, max] to a ByteMemory object. If no range is specified, all input bytes are copied.

staticofBytesData (input:BytesData, ?min:Int, ?max:Int):ByteMemory

Converts input in the range [min, max] to a ByteMemory object. If no range is specified, all input bytes are copied.

staticofVector (input:Vector<Int>, ?min:Int, ?max:Int):ByteMemory

Converts input in the range [min, max] to a ByteMemory object. If no range is specified, all input bytes are copied.

statictoArray (input:ByteMemory, ?min:Int, ?max:Int):Array<Int>

Converts input in the range [min, max] to an array. If no range is specified, all input bytes are copied.

statictoByteArray (input:ByteMemory, ?min:Int, ?max:Int):ByteArray

Converts input in the range [min, max] to a byte array. If no range is specified, all input bytes are copied. The bytes are written in little endian format.

statictoBytesData (input:ByteMemory, ?min:Int, ?max:Int):BytesData

Converts input in the range [min, max] to a BytesData object. If no range is specified, all input bytes are copied. The bytes are written in little endian format.

statictoVector (input:ByteMemory, ?min:Int, ?max:Int, ?out:Vector<Int>):Vector<Int>

Converts input in the range [min, max] to a Vector object. If no range is specified, all input bytes are copied.

Parameters:

out

the Vector object to write into. If null, a new Vector object is created on-the-fly.

Inherited Variables

Defined by MemoryAccess

read onlybytes:Int

The number of allocated bytes.

read onlykey:Int

A unique identifier for this object. A hash table transforms this key into an index of an array element by using a hash function.

name:String

read onlyoffset:Int

The memory offset in bytes.

Inherited Methods