com.marklogic.http

## Class BoyerMoore

- java.lang.Object
- - com.marklogic.http.BoyerMoore

-     public class BoyerMoore
      extends java.lang.Object

  This class applies Boyer Moore's search algorithm to find a pattern within a byte array.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static int` | `ALPHABET_SIZE`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `BoyerMoore(byte[] pattern)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `partialMatch()` Return the number of matching characters before the end of a chunk.
    `int` | `search(byte[] text, int start, int end)` Search for pattern in the byte array text.

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

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

- - ### Field Detail

    - #### ALPHABET_SIZE

          public static final int ALPHABET_SIZE

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### BoyerMoore

          public BoyerMoore(byte[] pattern)

  - ### Method Detail

    - #### search

          public int search(byte[] text,
                            int start,
                            int end)

      Search for pattern in the byte array text. Returns the position of the first occurrence of pattern if found and -1 otherwise.
      Parameters:
        `text` - byte array to search
        `start` - start position
        `end` - end position
      Returns:
        starting position of the first occurrence of pattern in text or -1 if not found.

    - #### partialMatch

          public int partialMatch()

      Return the number of matching characters before the end of a chunk.
      Returns:
        the number of matching characters.

Copyright © 2025 MarkLogic Corporation. All Rights Reserved.

Complete online documentation for MarkLogic Server, XQuery and related components may be found at developer.marklogic.com