private void encodeActiveAndStandbyHostPartitions(final DataOutputStream out) throws IOException {
        final Set<TopicPartition> allTopicPartitions = Stream
            .concat(partitionsByHost.values().stream(), standbyPartitionsByHost.values().stream())
            .flatMap(Collection::stream).collect(Collectors.toSet());
        final Map<String, Integer> topicNameDict = encodeTopicDictionaryAndGet(out, allTopicPartitions);
        encodeHostPartitionMapUsingDictionary(out, topicNameDict, partitionsByHost);
        encodeHostPartitionMapUsingDictionary(out, topicNameDict, standbyPartitionsByHost);
    }
@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