Home / Class/ AbstractSearchProcessorFactory Class — netty Architecture

AbstractSearchProcessorFactory Class — netty Architecture

Architecture documentation for the AbstractSearchProcessorFactory class in AbstractSearchProcessorFactory.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  9a2694e9_a657_fe47_243e_133b9fd7cfb8["AbstractSearchProcessorFactory"]
  0185ece2_dc33_83de_f24d_d3385686cb57["AbstractSearchProcessorFactory.java"]
  9a2694e9_a657_fe47_243e_133b9fd7cfb8 -->|defined in| 0185ece2_dc33_83de_f24d_d3385686cb57
  9dc61243_626a_7e6d_4256_bee04b3cc3ff["KmpSearchProcessorFactory()"]
  9a2694e9_a657_fe47_243e_133b9fd7cfb8 -->|method| 9dc61243_626a_7e6d_4256_bee04b3cc3ff
  65025c2b_851a_5d69_7adb_03b5d0c08209["BitapSearchProcessorFactory()"]
  9a2694e9_a657_fe47_243e_133b9fd7cfb8 -->|method| 65025c2b_851a_5d69_7adb_03b5d0c08209

Relationship Graph

Source Code

buffer/src/main/java/io/netty/buffer/search/AbstractSearchProcessorFactory.java lines 72–115

public abstract class AbstractSearchProcessorFactory implements SearchProcessorFactory {

    /**
     * Creates a {@link SearchProcessorFactory} based on
     * <a href="https://en.wikipedia.org/wiki/Knuth%E2%80%93Morris%E2%80%93Pratt_algorithm">Knuth-Morris-Pratt</a>
     * string search algorithm. It is a reasonable default choice among the provided algorithms.
     * <br>
     * Precomputation (this method) time is linear in the size of input ({@code O(|needle|)}).
     * <br>
     * The factory allocates and retains an int array of size {@code needle.length + 1}, and retains a reference
     * to the {@code needle} itself.
     * <br>
     * Search (the actual application of {@link SearchProcessor}) time is linear in the size of
     * {@link io.netty.buffer.ByteBuf} on which the search is performed ({@code O(|haystack|)}).
     * Every byte of {@link io.netty.buffer.ByteBuf} is processed only once, sequentially.
     *
     * @param needle an array of bytes to search for
     * @return a new instance of {@link KmpSearchProcessorFactory} precomputed for the given {@code needle}
     */
    public static KmpSearchProcessorFactory newKmpSearchProcessorFactory(byte[] needle) {
        return new KmpSearchProcessorFactory(needle);
    }

    /**
     * Creates a {@link SearchProcessorFactory} based on Bitap string search algorithm.
     * It is a jump free algorithm that has very stable performance (the contents of the inputs have a minimal
     * effect on it). The limitation is that the {@code needle} can be no more than 64 bytes long.
     * <br>
     * Precomputation (this method) time is linear in the size of the input ({@code O(|needle|)}).
     * <br>
     * The factory allocates and retains a long[256] array.
     * <br>
     * Search (the actual application of {@link SearchProcessor}) time is linear in the size of
     * {@link io.netty.buffer.ByteBuf} on which the search is performed ({@code O(|haystack|)}).
     * Every byte of {@link io.netty.buffer.ByteBuf} is processed only once, sequentially.
     *
     * @param needle an array <b>of no more than 64 bytes</b> to search for
     * @return a new instance of {@link BitapSearchProcessorFactory} precomputed for the given {@code needle}
     */
    public static BitapSearchProcessorFactory newBitapSearchProcessorFactory(byte[] needle) {
        return new BitapSearchProcessorFactory(needle);
    }

}

Frequently Asked Questions

What is the AbstractSearchProcessorFactory class?
AbstractSearchProcessorFactory is a class in the netty codebase, defined in buffer/src/main/java/io/netty/buffer/search/AbstractSearchProcessorFactory.java.
Where is AbstractSearchProcessorFactory defined?
AbstractSearchProcessorFactory is defined in buffer/src/main/java/io/netty/buffer/search/AbstractSearchProcessorFactory.java at line 72.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free