Package ghidra.util.datastruct
Class ByteArray
- java.lang.Object
-
- ghidra.util.datastruct.ByteArray
-
- All Implemented Interfaces:
Array
,java.io.Serializable
public class ByteArray extends java.lang.Object implements Array, java.io.Serializable
Array of bytes that grows as needed.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static int
MIN_SIZE
-
Constructor Summary
Constructors Constructor Description ByteArray()
Creates new ByteArray
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
copyDataTo(int index, DataTable table, int toIndex, int toCol)
Copies the underlying value for this array at the given index to the data table at the given index and column.byte
get(int index)
Returns the byte at the given indexint
getLastNonEmptyIndex()
Returns the index of the last non-null or non-zero element in the array.void
put(int index, byte value)
Puts the given byte value in the byte array at the given indexvoid
remove(int index)
Sets the value at the given index to 0.
-
-
-
Field Detail
-
MIN_SIZE
public static final int MIN_SIZE
- See Also:
- Constant Field Values
-
-
Method Detail
-
put
public void put(int index, byte value)
Puts the given byte value in the byte array at the given index- Parameters:
index
- Index into the array.value
- value to store- Throws:
java.lang.IndexOutOfBoundsException
- if the index is negative
-
remove
public void remove(int index)
Sets the value at the given index to 0.
-
get
public byte get(int index)
Returns the byte at the given index- Parameters:
index
- index into the array- Returns:
- The byte value at the given index. A 0 will be returned for any index not initialized to another value.
- Throws:
java.lang.IndexOutOfBoundsException
- if the index is negative
-
getLastNonEmptyIndex
public int getLastNonEmptyIndex()
Description copied from interface:Array
Returns the index of the last non-null or non-zero element in the array.- Specified by:
getLastNonEmptyIndex
in interfaceArray
- See Also:
Array.getLastNonEmptyIndex()
-
copyDataTo
public void copyDataTo(int index, DataTable table, int toIndex, int toCol)
Description copied from interface:Array
Copies the underlying value for this array at the given index to the data table at the given index and column. The data type at the column in the data table must be the same as the data in this array.- Specified by:
copyDataTo
in interfaceArray
- Parameters:
index
- index into this array to copy the value from.table
- the data table object to copy the data to.toIndex
- the index into the destination data table to copy the value.toCol
- the data table column to store the value. Must be the same type as this array.- See Also:
Array.copyDataTo(int, DataTable, int, int)
-
-