@Override
    public long position(byte[] pattern, long startOrdinal) {
        assertNotFreed();
        if (startOrdinal < 1 || startOrdinal > len) {
            return -1;
        }

        final long patternLength = pattern.length;
        int pos = (int) startOrdinal - 1;
        int i = 0;

        while (pos < len) {
            if (pattern[i] == buf[pos]) {
                if (i + 1 == patternLength) {
                    return (pos + 1) - (patternLength - 1);
                }
                i++; pos++;
            } else if (pattern[i] != buf[pos]) {
                pos++;
            }
        }
        return -1;
    }
A standard implementation of the Blob interface.
<p>
By having an implementation, we do not have to
require usage of the java.sql.rowset module.

@author Per Minborg
@since 3.2.0
runtime-parent/runtime-typemapper/src/main/java/com/speedment/runtime/typemapper/largeobject/StandardBlob.java