@Override
    public int setBytes(long posOrdinal, byte[] bytes, int offset, int length) throws SQLException {
        assertNotFreed();
        if (offset < 0 || offset > bytes.length) {
            throw newIllegalArgumentExceptionRange("offset", 0, bytes.length, offset);
        }

        if (posOrdinal < 1 || posOrdinal > len) {
            throw newIllegalArgumentExceptionRange("pos", 1, length(), posOrdinal);
        }

        if ((long) (length) > origLen) {
            throw new IllegalArgumentException("Buffer is not sufficient to hold the value");
        }

        if ((length + offset) > bytes.length) {
            throw new IllegalArgumentException("Cannot have combined offset and length that is greater that the Blob buffer");
        }

        final long pos = posOrdinal -1;
        int i = 0;
        while ( i < length || (offset + i +1) < (bytes.length-offset) ) {
            buf[(int) pos + i] = bytes[offset + i];
            i++;
        }
        return i;
    }
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