Class KMPDataIndexer
java.lang.Object
cool.scx.io.KMPDataIndexer
- All Implemented Interfaces:
DataIndexer
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic int[]computeLPSArray(byte[] pattern) intindexOf(byte[] bytes, int position, int length) 如果 没找到返回 -1 否则返回索引位置 此方法会循环调用 所以注意内部处理 建议每次都重新创建
-
Constructor Details
-
KMPDataIndexer
public KMPDataIndexer(byte[] pattern)
-
-
Method Details
-
computeLPSArray
public static int[] computeLPSArray(byte[] pattern) -
indexOf
public int indexOf(byte[] bytes, int position, int length) Description copied from interface:DataIndexer如果 没找到返回 -1 否则返回索引位置 此方法会循环调用 所以注意内部处理 建议每次都重新创建- Specified by:
indexOfin interfaceDataIndexer- Parameters:
bytes- bytesposition- positionlength- length- Returns:
- l
-