Package ghidra.features.base.memsearch.matcher

# Class ByteMatcher

java.lang.Object
ghidra.features.base.memsearch.matcher.ByteMatcher

Direct Known Subclasses:
  `CombinedByteMatcher`, `InvalidByteMatcher`, `MaskedByteSequenceByteMatcher`, `RegExByteMatcher`

public abstract class ByteMatcher extends Object
ByteMatcher is the base class for an object that be used to scan bytes looking for sequences that match some criteria. As a convenience, it also stores the input string and settings that were used to generated this ByteMatcher.

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `static final record`
  `ByteMatcher.ByteMatch`
  Record class to contain a match specification.

- ## Constructor Summary

  Constructors
  Modifier
  Constructor
  Description
  `protected`
  `ByteMatcher(String name, String input, SearchSettings settings)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `boolean`
  `equals(Object obj)`
  `abstract String`
  `getDescription()`
  Returns a description of what this byte matcher matches.
  `final String`
  `getInput()`
  Returns the original input text that generated this ByteMatacher.
  `String`
  `getName()`
  Returns the name of this byte matcher..
  `SearchSettings`
  `getSettings()`
  Returns the settings used to generate this ByteMatcher.
  `abstract String`
  `getToolTip()`
  Returns additional information about this byte matcher.
  `int`
  `hashCode()`
  `boolean`
  `isValidInput()`
  Returns true if this byte matcher has valid (but possibly incomplete) input text.
  `boolean`
  `isValidSearch()`
  Returns true if this byte matcher is valid and can be used to perform a search.
  `abstract Iterable<ByteMatcher.ByteMatch>`
  `match(ExtendedByteSequence bytes)`
  Returns an `Iterable` for returning matches within the given byte sequence.
  `String`
  `toString()`

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

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

- ## Constructor Details

  - ### ByteMatcher

    protected ByteMatcher(String name, String input, SearchSettings settings)

- ## Method Details

  - ### getName

    public String getName()
    Returns the name of this byte matcher..
    Returns:
      the name of this byte matcher.

  - ### getInput

    public final String getInput()
    Returns the original input text that generated this ByteMatacher.
    Returns:
      the original input text that generated this BytesMatcher

  - ### getSettings

    public SearchSettings getSettings()
    Returns the settings used to generate this ByteMatcher.
    Returns:
      the settings used to generate this ByteMatcher

  - ### match

    public abstract Iterable<ByteMatcher.ByteMatch> match(ExtendedByteSequence bytes)
    Returns an `Iterable` for returning matches within the given byte sequence.
    Parameters:
      `bytes` - the byte sequence to search
    Returns:
      an iterable for return matches in the given sequence

  - ### getDescription

    public abstract String getDescription()
    Returns a description of what this byte matcher matches. (Typically a sequence of bytes)
    Returns:
      a description of what this byte matcher matches

  - ### getToolTip

    public abstract String getToolTip()
    Returns additional information about this byte matcher. (Typically the mask bytes)
    Returns:
      additional information about this byte matcher

  - ### isValidSearch

    public boolean isValidSearch()
    Returns true if this byte matcher is valid and can be used to perform a search. If false, the description will return an error message explaining why this byte matcher is invalid.
    Returns:
      true if this byte matcher is valid and can be used to perform a search.

  - ### isValidInput

    public boolean isValidInput()
    Returns true if this byte matcher has valid (but possibly incomplete) input text. For example, when entering decimal values, the input could be just "-" as the user starts to enter a negative number. In this case the input is valid, but the `isValidSearch()` would return false.
    Returns:
      true if this byte matcher has valid text

  - ### toString

    public String toString()
    Overrides:
      `toString` in class `Object`

  - ### hashCode

    public int hashCode()
    Overrides:
      `hashCode` in class `Object`

  - ### equals

    public boolean equals(Object obj)
    Overrides:
      `equals` in class `Object`