Skip to main content

HttpMultipartParser::SubsequenceFinder

Provides methods to find a subsequence within a sequence.

Public Functions

Name
intSearch(byte[] haystack, byte[] needle)
Finds if a sequence exists within another sequence.
intSearch(byte[] haystack, byte[] needle, int haystackLength)
Finds if a sequence exists within another sequence.

Public Functions Documentation

static int Search(
byte[] haystack,
byte[] needle
)

Finds if a sequence exists within another sequence.

Parameters:

  • haystack The sequence to search.
  • needle The sequence to look for.

Return: The start position of the found sequence or -1 if nothing was found.

function Search

static int Search(
byte[] haystack,
byte[] needle,
int haystackLength
)

Finds if a sequence exists within another sequence.

Parameters:

  • haystack The sequence to search.
  • needle The sequence to look for.
  • haystackLength The length of the haystack to consider for searching.

Return: The start position of the found sequence or -1 if nothing was found.

Inspired by https://stackoverflow.com/a/39021296/153084 .