docs: public boolean decode(ByteBuf buffer, RedisCommand<?, ?, ?> command, CommandOutput<?, ?, ?> output) {
          int length, end;
          ByteBuffer bytes;
  
          if (debugEnabled) {
              logger.debug("Decode {}", command);
          }
  
          if (isEmpty(stack)) {
              add(stack, new State());
          }
  
          if (output == null) {
              return isEmpty(stack);
          }
  
          loop:
  
          while (!isEmpty(stack)) {
              State state = peek(stack);
  
              if (state.type == null) {
                  if (!buffer.isReadable()) {
                      break;
                  }
                  state.type = readReplyType(buffer);
                  buffer.markReaderIndex();
              }
  
              switch (state.type) {
                  case SINGLE:
                      if ((bytes = readLine(buffer)) == null) {
                          break loop;
                      }
  
                      if (!QUEUED.equals(bytes)) {
                          safeSetSingle(output, bytes, command);
                      }
                      break;
                  case ERROR:
                      if ((bytes = readLine(buffer)) == null) {
                          break loop;
                      }
                      safeSetError(output, bytes, command);
                      break;
                  case INTEGER:
                      if ((end = findLineEnd(buffer)) == -1) {
                          break loop;
                      }
                      long integer = readLong(buffer, buffer.readerIndex(), end);
                      safeSet(output, integer, command);
                      break;
                  case BULK:
                      if ((end = findLineEnd(buffer)) == -1) {
                          break loop;
                      }
                      length = (int) readLong(buffer, buffer.readerIndex(), end);
                      if (length == -1) {
                          safeSet(output, null, command);
                      } else {
                          state.type = BYTES;
                          state.count = length + 2;
                          buffer.markReaderIndex();
                          continue loop;
                      }
                      break;
                  case MULTI:
                      if (state.count == -1) {
                          if ((end = findLineEnd(buffer)) == -1) {
                              break loop;
                          }
                          length = (int) readLong(buffer, buffer.readerIndex(), end);
                          state.count = length;
                          buffer.markReaderIndex();
                          safeMulti(output, state.count, command);
                      }
  
                      if (state.count <= 0) {
                          break;
                      }
  
                      state.count--;
                      addFirst(stack, new State());
  
                      continue loop;
                  case BYTES:
                      if ((bytes = readBytes(buffer, state.count)) == null) {
                          break loop;
                      }
                      safeSet(output, bytes, command);
                      break;
                  default:
                      throw new IllegalStateException("State " + state.type + " not supported");
              }
  
              buffer.markReaderIndex();
              remove(stack);
  
              output.complete(size(stack));
          }
  
          if (debugEnabled) {
              logger.debug("Decoded {}, empty stack: {}", command, isEmpty(stack));
          }
  
          return isEmpty(stack);
      }