docs: public long parse() throws IOException {
          /*
           * ----------------------------
           * 52 45 44 49 53              # Magic String "REDIS"
           * 30 30 30 33                 # RDB Version Number in big endian. In this case, version = 0003 = 3
           * ----------------------------
           */
          this.replicator.submitEvent(new PreRdbSyncEvent());
          rdbVisitor.applyMagic(in);
          int version = rdbVisitor.applyVersion(in);
          DB db = null;
          /*
           * rdb
           */
          loop:
          while (this.replicator.getStatus() == CONNECTED) {
              Event event = null;
              int type = rdbVisitor.applyType(in);
              ContextKeyValuePair kv = new ContextKeyValuePair();
              kv.setDb(db);
              switch (type) {
                  case RDB_OPCODE_EXPIRETIME:
                      event = rdbVisitor.applyExpireTime(in, version, kv);
                      break;
                  case RDB_OPCODE_EXPIRETIME_MS:
                      event = rdbVisitor.applyExpireTimeMs(in, version, kv);
                      break;
                  case RDB_OPCODE_FREQ:
                      event = rdbVisitor.applyFreq(in, version, kv);
                      break;
                  case RDB_OPCODE_IDLE:
                      event = rdbVisitor.applyIdle(in, version, kv);
                      break;
                  case RDB_OPCODE_AUX:
                      event = rdbVisitor.applyAux(in, version);
                      break;
                  case RDB_OPCODE_MODULE_AUX:
                      event = rdbVisitor.applyModuleAux(in, version);
                      break;
                  case RDB_OPCODE_RESIZEDB:
                      rdbVisitor.applyResizeDB(in, version, kv);
                      break;
                  case RDB_OPCODE_SELECTDB:
                      db = rdbVisitor.applySelectDB(in, version);
                      break;
                  case RDB_OPCODE_EOF:
                      long checksum = rdbVisitor.applyEof(in, version);
                      this.replicator.submitEvent(new PostRdbSyncEvent(checksum));
                      break loop;
                  case RDB_TYPE_STRING:
                      event = rdbVisitor.applyString(in, version, kv);
                      break;
                  case RDB_TYPE_LIST:
                      event = rdbVisitor.applyList(in, version, kv);
                      break;
                  case RDB_TYPE_SET:
                      event = rdbVisitor.applySet(in, version, kv);
                      break;
                  case RDB_TYPE_ZSET:
                      event = rdbVisitor.applyZSet(in, version, kv);
                      break;
                  case RDB_TYPE_ZSET_2:
                      event = rdbVisitor.applyZSet2(in, version, kv);
                      break;
                  case RDB_TYPE_HASH:
                      event = rdbVisitor.applyHash(in, version, kv);
                      break;
                  case RDB_TYPE_HASH_ZIPMAP:
                      event = rdbVisitor.applyHashZipMap(in, version, kv);
                      break;
                  case RDB_TYPE_LIST_ZIPLIST:
                      event = rdbVisitor.applyListZipList(in, version, kv);
                      break;
                  case RDB_TYPE_SET_INTSET:
                      event = rdbVisitor.applySetIntSet(in, version, kv);
                      break;
                  case RDB_TYPE_ZSET_ZIPLIST:
                      event = rdbVisitor.applyZSetZipList(in, version, kv);
                      break;
                  case RDB_TYPE_HASH_ZIPLIST:
                      event = rdbVisitor.applyHashZipList(in, version, kv);
                      break;
                  case RDB_TYPE_LIST_QUICKLIST:
                      event = rdbVisitor.applyListQuickList(in, version, kv);
                      break;
                  case RDB_TYPE_MODULE:
                      event = rdbVisitor.applyModule(in, version, kv);
                      break;
                  case RDB_TYPE_MODULE_2:
                      event = rdbVisitor.applyModule2(in, version, kv);
                      break;
                  case RDB_TYPE_STREAM_LISTPACKS:
                      event = rdbVisitor.applyStreamListPacks(in, version, kv);
                      break;
                  default:
                      throw new AssertionError("unexpected value type:" + type + ", check your ModuleParser or ValueIterableRdbVisitor.");
              }
              if (event == null) continue;
              if (replicator.verbose() && logger.isDebugEnabled()) logger.debug("{}", event);
              this.replicator.submitEvent(event);
          }
          return in.total();
      }