Package ghidra.program.util

# Class DefinedStringIterator

java.lang.Object
ghidra.program.util.DefinedStringIterator

All Implemented Interfaces:
  `DataIterator`, `Iterable<Data>`, `Iterator<Data>`

public class DefinedStringIterator extends Object implements DataIterator
Iterator that visits each defined string instance in the initialized memory of a Program or in the footprint of a specified data element.

Strings that are nested inside of composites or arrays are visited, not just the parent/containing data element.

Not thread safe.

- ## Nested Class Summary

  ## Nested classes/interfaces inherited from interface ghidra.program.model.listing.DataIterator

  `DataIterator.IteratorWrapper`

- ## Field Summary

  ### Fields inherited from interface ghidra.program.model.listing.DataIterator

  `EMPTY`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static DefinedStringIterator`
  `forDataInstance(Data singleDataInstance)`
  Creates a new iterator that traverses the address space of a single data item (ie.
  `static DefinedStringIterator`
  `forProgram(Program program)`
  Creates a new iterator that traverses the entire Program's address space returning data instances that are strings.
  `static DefinedStringIterator`
  `forProgram(Program program, AddressSetView addrs)`
  Creates a new iterator that traverses a portion of the Program's address space returning data instances that are strings.
  `int`
  `getDataCandidateCount()`
  `boolean`
  `hasNext()`
  `Data`
  `next()`

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

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

  ### Methods inherited from interface ghidra.program.model.listing.DataIterator

  `iterator`

  ### Methods inherited from interface java.lang.Iterable

  `forEach, spliterator`

  ### Methods inherited from interface java.util.Iterator

  `forEachRemaining, remove`

- ## Method Details

  - ### forProgram

    public static DefinedStringIterator forProgram(Program program)
    Creates a new iterator that traverses the entire Program's address space returning data instances that are strings.
    Parameters:
      `program` - Ghidra `Program` to search
    Returns:
      new iterator

  - ### forProgram

    public static DefinedStringIterator forProgram(Program program, AddressSetView addrs)
    Creates a new iterator that traverses a portion of the Program's address space returning data instances that are strings.
    Parameters:
      `program` - Ghidra `Program` to search
      `addrs` - addresses to limit the iteration to
    Returns:
      new iterator

  - ### forDataInstance

    public static DefinedStringIterator forDataInstance(Data singleDataInstance)
    Creates a new iterator that traverses the address space of a single data item (ie. a composite or array data instance that needs to be recursed into).
    Parameters:
      `singleDataInstance` - Data instance
    Returns:
      new iterator

  - ### hasNext

    public boolean hasNext()
    Specified by:
      `hasNext` in interface `DataIterator`
    Specified by:
      `hasNext` in interface `Iterator<Data>`

  - ### next

    public Data next()
    Specified by:
      `next` in interface `DataIterator`
    Specified by:
      `next` in interface `Iterator<Data>`

  - ### getDataCandidateCount

    public int getDataCandidateCount()