Home / Class/ Processor Class — netty Architecture

Processor Class — netty Architecture

Architecture documentation for the Processor class in KmpSearchProcessorFactory.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  0d63c09d_1a8c_9c20_539e_1ce7bf8f3999["Processor"]
  1a745834_0c75_ddd1_812e_784026a3e4b0["KmpSearchProcessorFactory.java"]
  0d63c09d_1a8c_9c20_539e_1ce7bf8f3999 -->|defined in| 1a745834_0c75_ddd1_812e_784026a3e4b0
  39458598_93b8_9b1e_533b_06f1b95e5ad7["Processor()"]
  0d63c09d_1a8c_9c20_539e_1ce7bf8f3999 -->|method| 39458598_93b8_9b1e_533b_06f1b95e5ad7
  a5b9168b_6c50_73c6_9e11_09b6ada55541["process()"]
  0d63c09d_1a8c_9c20_539e_1ce7bf8f3999 -->|method| a5b9168b_6c50_73c6_9e11_09b6ada55541
  82c66712_18b3_0421_73af_1305186d634b["reset()"]
  0d63c09d_1a8c_9c20_539e_1ce7bf8f3999 -->|method| 82c66712_18b3_0421_73af_1305186d634b

Relationship Graph

Source Code

buffer/src/main/java/io/netty/buffer/search/KmpSearchProcessorFactory.java lines 34–65

    public static class Processor implements SearchProcessor {

        private final byte[] needle;
        private final int[] jumpTable;
        private long currentPosition;

        Processor(byte[] needle, int[] jumpTable) {
            this.needle = needle;
            this.jumpTable = jumpTable;
        }

        @Override
        public boolean process(byte value) {
            while (currentPosition > 0 && PlatformDependent.getByte(needle, currentPosition) != value) {
                currentPosition = PlatformDependent.getInt(jumpTable, currentPosition);
            }
            if (PlatformDependent.getByte(needle, currentPosition) == value) {
                currentPosition++;
            }
            if (currentPosition == needle.length) {
                currentPosition = PlatformDependent.getInt(jumpTable, currentPosition);
                return false;
            }

            return true;
        }

        @Override
        public void reset() {
            currentPosition = 0;
        }
    }

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free