Class KMPByteIndexer

java.lang.Object
cool.scx.bytes.indexer.KMPByteIndexer
All Implemented Interfaces:
ByteIndexer

public final class KMPByteIndexer extends Object implements ByteIndexer
KMPByteIndexer
Version:
0.0.1
Author:
scx567888
  • Constructor Details

    • KMPByteIndexer

      public KMPByteIndexer(byte[] pattern)
  • Method Details

    • buildLPS

      public static int[] buildLPS(byte[] pattern)
    • indexOf

      public int indexOf(ByteChunk chunk)
      Description copied from interface: ByteIndexer
      支持跨 chunk 的回溯匹配, 因此返回值可能为负数 若未匹配到 请返回 Integer.MIN_VALUE
      Specified by:
      indexOf in interface ByteIndexer
      Parameters:
      chunk - chunk
      Returns:
      匹配的索引位置
    • pattern

      public byte[] pattern()
    • matchedLength

      public int matchedLength()
      当前已匹配的模式串长度
    • reset

      public void reset()