private void writeTopicPartitions(final DataOutputStream out,
                                      final Set<TopicPartition> partitions) throws IOException {
        out.writeInt(partitions.size());
        for (final TopicPartition partition : partitions) {
            out.writeUTF(partition.topic());
            out.writeInt(partition.partition());
        }
    }
@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