Package ghidra.app.util.bin.format.swift

# Class SwiftUtils

java.lang.Object
ghidra.app.util.bin.format.swift.SwiftUtils

public class SwiftUtils extends Object
Swift-related utility methods

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final PointerTypedef`
  `PTR_RELATIVE`
  A `pointer` to a relative 4-byte offset
  `static final PointerTypedef`
  `PTR_STRING`
  A `string pointer` to a 4-byte relative offset

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `SwiftUtils()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static List<MemoryBlock>`
  `getSwiftBlocks(SwiftSection section, Program program)`
  Gets a `List` of `MemoryBlock`s that match the given `SwiftSection`
  `static boolean`
  `isSwift(Program program)`
  Checks if the given `Program` is a Swift program
  `static String`
  `relativeString(BinaryReader reader)`
  Reads the integer at the current index and uses it as a relative pointer to read and return a string at that location.

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

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### PTR_RELATIVE

    public static final PointerTypedef PTR_RELATIVE
    A `pointer` to a relative 4-byte offset

  - ### PTR_STRING

    public static final PointerTypedef PTR_STRING
    A `string pointer` to a 4-byte relative offset

- ## Constructor Details

  - ### SwiftUtils

    public SwiftUtils()

- ## Method Details

  - ### isSwift

    public static boolean isSwift(Program program)
    Checks if the given `Program` is a Swift program
    Parameters:
      `program` - The `Program` to check
    Returns:
      True if the given `Program` is a Swift program; otherwise, false

  - ### getSwiftBlocks

    public static List<MemoryBlock> getSwiftBlocks(SwiftSection section, Program program)
    Gets a `List` of `MemoryBlock`s that match the given `SwiftSection`
    Parameters:
      `section` - The `SwiftSection`
      `program` - The `Program`
    Returns:
      A `List` of `MemoryBlock`s that match the given `SwiftSection`

  - ### relativeString

    public static String relativeString(BinaryReader reader) throws IOException
    Reads the integer at the current index and uses it as a relative pointer to read and return a string at that location. When the read completes, the `BinaryReader` will be positioned directly after the initial relative pointer that was read.
    Parameters:
      `reader` - A `BinaryReader` positioned at the start of relative string pointer
    Returns:
      The read string
    Throws:
      `IOException` - if there was an IO-related problem during the reads