Package mondrian.olap

Class Util.ByteMatcher

  • Enclosing class:
    Util

    public static class Util.ByteMatcher
    extends Object
    This class implements the Knuth-Morris-Pratt algorithm to search within a byte array for a token byte array.
    • Field Detail

      • key

        public final byte[] key
    • Constructor Detail

      • ByteMatcher

        public ByteMatcher​(byte[] key)
    • Method Detail

      • match

        public int match​(byte[] a)
        Matches the pre-compiled byte array token against a byte array variable and returns the index of the key within the array.
        Parameters:
        a - An array of bytes to search for.
        Returns:
        -1 if not found, or the index (0 based) of the match.