Package ghidra.program.util
Class DefinedDataIterator
- java.lang.Object
-
- ghidra.program.util.DefinedDataIterator
-
- All Implemented Interfaces:
DataIterator
,java.lang.Iterable<Data>
,java.util.Iterator<Data>
public class DefinedDataIterator extends java.lang.Object implements DataIterator
Iterator that visits each defined data instance in the initialized memory of a Program or in the footprint of a specified data element.Data elements that are nested inside of composites or arrays are visited, not just the parent/containing data element.
-
-
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
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static DefinedDataIterator
byDataInstance(Program program, java.util.function.Predicate<Data> dataInstancePredicate)
Creates a new iterator that traverses the entire Program's address space, returning data instances that successfully match the predicate.static DefinedDataIterator
byDataType(Program program, AddressSetView addresses, java.util.function.Predicate<DataType> dataTypePredicate)
Creates a new iterator that traverses a portion of the Program's address space, returning data instances that successfully match the predicate.static DefinedDataIterator
byDataType(Program program, java.util.function.Predicate<DataType> dataTypePredicate)
Creates a new iterator that traverses the entire Program's address space, returning data instances that successfully match the predicate.static DefinedDataIterator
definedStrings(Data singleDataInstance)
Creates a new iterator that traverses the address space of a single data item (ie.static DefinedDataIterator
definedStrings(Program program)
Creates a new iterator that traverses the entire Program's address space returning data instances that are strings.static DefinedDataIterator
definedStrings(Program program, AddressSetView addrs)
Creates a new iterator that traverses a portion of the Program's address space returning data instances that are strings.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
-
-
-
-
Method Detail
-
byDataType
public static DefinedDataIterator byDataType(Program program, java.util.function.Predicate<DataType> dataTypePredicate)
Creates a new iterator that traverses the entire Program's address space, returning data instances that successfully match the predicate.- Parameters:
program
- Program to searchdataTypePredicate
-Predicate
that tests each data instance'sDataType
- Returns:
- new iterator
-
byDataType
public static DefinedDataIterator byDataType(Program program, AddressSetView addresses, java.util.function.Predicate<DataType> dataTypePredicate)
Creates a new iterator that traverses a portion of the Program's address space, returning data instances that successfully match the predicate.- Parameters:
program
- Program to searchaddresses
- addresses to limit the iteration todataTypePredicate
-Predicate
that tests each data instance'sDataType
- Returns:
- new iterator
-
byDataInstance
public static DefinedDataIterator byDataInstance(Program program, java.util.function.Predicate<Data> dataInstancePredicate)
Creates a new iterator that traverses the entire Program's address space, returning data instances that successfully match the predicate.- Parameters:
program
- Program to searchdataInstancePredicate
-Predicate
that tests each data instance's properties- Returns:
- new iterator
-
definedStrings
public static DefinedDataIterator definedStrings(Program program)
Creates a new iterator that traverses the entire Program's address space returning data instances that are strings.- Parameters:
program
- GhidraProgram
to search- Returns:
- new iterator
-
definedStrings
public static DefinedDataIterator definedStrings(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
- GhidraProgram
to searchaddrs
- addresses to limit the iteration to- Returns:
- new iterator
-
definedStrings
public static DefinedDataIterator definedStrings(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 interfaceDataIterator
- Specified by:
hasNext
in interfacejava.util.Iterator<Data>
-
next
public Data next()
- Specified by:
next
in interfaceDataIterator
- Specified by:
next
in interfacejava.util.Iterator<Data>
-
-