docs: public void setPosition(int newIndex) {
      if (index != newIndex) {
        if (index == -1 || index > newIndex) {
          pos = 0;
          index = 0;
        } else {
          index++;
          if (length != NULL_LENGTH) {
            pos += length;
          }
        }
  
        for (; index <= newIndex; index++) {
          if (index != newIndex) {
            int type = this.buf[this.pos++] & 0xff;
            switch (type) {
              case 251:
                break;
              case 252:
                pos += 2 + (0xffff & (((buf[pos] & 0xff) + ((buf[pos + 1] & 0xff) << 8))));
                break;
              case 253:
                pos += 3 + (0xffffff & ((buf[pos] & 0xff)
                    + ((buf[pos + 1] & 0xff) << 8)
                    + ((buf[pos + 2] & 0xff) << 16)));
                break;
              case 254:
                pos += 8 + ((buf[pos] & 0xff)
                    + ((long) (buf[pos + 1] & 0xff) << 8)
                    + ((long) (buf[pos + 2] & 0xff) << 16)
                    + ((long) (buf[pos + 3] & 0xff) << 24)
                    + ((long) (buf[pos + 4] & 0xff) << 32)
                    + ((long) (buf[pos + 5] & 0xff) << 40)
                    + ((long) (buf[pos + 6] & 0xff) << 48)
                    + ((long) (buf[pos + 7] & 0xff) << 56));
                break;
              default:
                pos += type;
                break;
            }
          } else {
            int type = this.buf[this.pos++] & 0xff;
            switch (type) {
              case 251:
                length = NULL_LENGTH;
                this.lastValueNull = BIT_LAST_FIELD_NULL;
                return;
              case 252:
                length = 0xffff & ((buf[pos++] & 0xff)
                    + ((buf[pos++] & 0xff) << 8));
                break;
              case 253:
                length = 0xffffff & ((buf[pos++] & 0xff)
                    + ((buf[pos++] & 0xff) << 8)
                    + ((buf[pos++] & 0xff) << 16));
                break;
              case 254:
                length = (int) ((buf[pos++] & 0xff)
                    + ((long) (buf[pos++] & 0xff) << 8)
                    + ((long) (buf[pos++] & 0xff) << 16)
                    + ((long) (buf[pos++] & 0xff) << 24)
                    + ((long) (buf[pos++] & 0xff) << 32)
                    + ((long) (buf[pos++] & 0xff) << 40)
                    + ((long) (buf[pos++] & 0xff) << 48)
                    + ((long) (buf[pos++] & 0xff) << 56));
                break;
              default:
                length = type;
                break;
            }
            this.lastValueNull = BIT_LAST_FIELD_NOT_NULL;
            return;
          }
        }
      }
      this.lastValueNull = length == NULL_LENGTH ? BIT_LAST_FIELD_NULL : BIT_LAST_FIELD_NOT_NULL;
    }