functions to search a byte stream for a byte pattern
create a context with the byte pattern
call the search function repeatedly to process each sequential buffer of stream contents
each call to search returns a new context when it:
retrieve the search result from the new context using the match function. The result is either:
if a match was found, a Long containing the offset of the match within the stream of bytes processed, or
if no match was not found, nil
each returned context also contains enough state to allow matching across buffer boundaries
to find all matches, call search on each buffer repeatedly until match returns nil, then continue searching the next buffer
search-file is useful both in its own right and as an example
reference: http://www.inf.fh-flensburg.de/lang/algorithmen/pattern/kmpen.htm
functions to search a byte stream for a byte pattern - create a context with the byte pattern - call the search function repeatedly to process each sequential buffer of stream contents - each call to search returns a new context when it: - finds a match within a buffer, or - exhausts a buffer without finding a match - retrieve the search result from the new context using the match function. The result is either: - if a match was found, a Long containing the offset of the match within the stream of bytes processed, or - if no match was not found, nil - each returned context also contains enough state to allow matching across buffer boundaries - to find all matches, call search on each buffer repeatedly until match returns nil, then continue searching the next buffer - the context for each call to search will be the context returned by the previous call - search-file is useful both in its own right and as an example reference: http://www.inf.fh-flensburg.de/lang/algorithmen/pattern/kmpen.htm
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close