Package ghidra.program.util

# Class BytesFieldLocation

java.lang.Object
ghidra.program.util.ProgramLocation
ghidra.program.util.CodeUnitLocation
ghidra.program.util.BytesFieldLocation

All Implemented Interfaces:
  `Cloneable`, `Comparable<ProgramLocation>`

public class BytesFieldLocation extends CodeUnitLocation
Provides specific information about the bytes field within a program location.

- ## Field Summary

  ### Fields inherited from class ghidra.program.util.ProgramLocation

  `addr, program, refAddr`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `BytesFieldLocation()`
  Default constructor needed for restoring a byte field location from XML.
  `BytesFieldLocation(Program program, Address addr)`
  Creates a new BytesFieldLocation for the given address.
  `BytesFieldLocation(Program program, Address addr, Address byteAddress, int[] componentPath, int columnInByte)`
  Create a new BytesFieldLocation which represents a specific byte address.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `Address`
  `getAddressForByte()`
  `int`
  `getByteIndex()`
  Returns the index of byte that represents the current program location.
  `int`
  `getColumn()`
  This is overridden here because previous versions used to store the byte index in the column field.
  `int`
  `getColumnInByte()`
  Returns the character position within the byte specified by getByteIndex().

  ### Methods inherited from class ghidra.program.util.CodeUnitLocation

  `isValid`

  ### Methods inherited from class ghidra.program.util.ProgramLocation

  `clone, compareAddr, compareTo, equals, getAddress, getByteAddress, getCharOffset, getComponentPath, getLocation, getProgram, getRefAddress, getRow, getTranslatedCopy, hashCode, restoreState, saveState, toString`

  ### Methods inherited from class java.lang.Object

  `finalize, getClass, notify, notifyAll, wait, wait, wait`

- ## Constructor Details

  - ### BytesFieldLocation

    public BytesFieldLocation(Program program, Address addr, Address byteAddress, int[] componentPath, int columnInByte)
    Create a new BytesFieldLocation which represents a specific byte address.
    Parameters:
      `program` - the program for this location.
      `addr` - the address of the code unit containing this location.
      `byteAddress` - the address of this location which can be the address of a specific byte within a code unit.
      `componentPath` - the data component path which is specified as an array of indexes where each index indicates the index into nested structures. For instructions or simple data, this should be null.
      `columnInByte` - the character position in the the bytes

  - ### BytesFieldLocation

    public BytesFieldLocation(Program program, Address addr)
    Creates a new BytesFieldLocation for the given address. The address will be adjusted to the beginning of the code unit containing that address(if it exists). The original address can be retrieved using the "getByteAddress()" method.
    Parameters:
      `program` - the program that this location is related.
      `addr` - the address of the byte for this location.

  - ### BytesFieldLocation

    public BytesFieldLocation()
    Default constructor needed for restoring a byte field location from XML.

- ## Method Details

  - ### getByteIndex

    public int getByteIndex()
    Returns the index of byte that represents the current program location. Sources that do not get this specific should simply return 0.
    Returns:
      the index

  - ### getColumn

    public int getColumn()
    This is overridden here because previous versions used to store the byte index in the column field. So if anyone was incorrectly using getColumn() to get the byte index, then this override will allow that to keep working.
    Overrides:
      `getColumn` in class `ProgramLocation`
    Returns:
      the column.

  - ### getColumnInByte

    public int getColumnInByte()
    Returns the character position within the byte specified by getByteIndex(). Normally, this is 1, 2, or 3 corresponding to before the byte, between the nibbles of the byte or past the byte. Sometimes, extra delimiters may exist allowing the position to be greater than 3.
    Returns:
      the column

  - ### getAddressForByte

    public Address getAddressForByte()