private void encodeActiveAndStandbyTaskAssignment(final DataOutputStream out) throws IOException {
        // encode active tasks
        out.writeInt(activeTasks.size());
        for (final TaskId id : activeTasks) {
            writeTaskIdTo(id, out, usedVersion);
        }

        // encode standby tasks
        out.writeInt(standbyTasks.size());
        for (final Map.Entry<TaskId, Set<TopicPartition>> entry : standbyTasks.entrySet()) {
            final TaskId id = entry.getKey();
            writeTaskIdTo(id, out, usedVersion);

            final Set<TopicPartition> partitions = entry.getValue();
            writeTopicPartitions(out, partitions);
        }
    }
@throws TaskAssignmentException if method fails to encode the data, e.g., if there is an
IO exception during encoding
streams/src/main/java/org/apache/kafka/streams/processor/internals/assignment/AssignmentInfo.java