// Path: src/main/java/kafka/utils/Function2.java
// public interface Function2<A1,A2,B> {
//     B apply(A1 arg1, A2 arg2);
// }


import kafka.network.MultiSend;
import kafka.network.Send;
import kafka.utils.Function2;
import kafka.utils.Utils;
import java.nio.ByteBuffer;
import java.nio.channels.GatheringByteChannel;
import java.util.List;
import static kafka.api.ApiUtils.writeShortString;
package kafka.api;




public class TopicDataSend extends Send {
    public TopicData topicData;

    public static class TopicDataMultiSend extends MultiSend<PartitionDataSend> {
        protected TopicDataMultiSend(TopicData topicData, List<PartitionDataSend> sends) {
            super(sends);
            expectedBytesToWrite = topicData.sizeInBytes() - topicData.headerSize();
        }
    }

    public TopicDataSend(TopicData topicData) {
        this.topicData = topicData;
        size = topicData.sizeInBytes();

        buffer = ByteBuffer.allocate(topicData.headerSize());

        writeShortString(buffer, topicData.topic);
        buffer.putInt(topicData.partitionData.size());
        buffer.rewind();

        List<PartitionDataSend> sendData = Utils.mapList(topicData.partitionData,
// Path: src/main/java/kafka/utils/Function2.java
// public interface Function2<A1,A2,B> {
//     B apply(A1 arg1, A2 arg2);
// }


// Path: src/main/java/kafka/api/TopicDataSend.java
import kafka.network.MultiSend;
import kafka.network.Send;
import kafka.utils.Function2;
import kafka.utils.Utils;
import java.nio.ByteBuffer;
import java.nio.channels.GatheringByteChannel;
import java.util.List;
import static kafka.api.ApiUtils.writeShortString;

package kafka.api;




public class TopicDataSend extends Send {
    public TopicData topicData;

    public static class TopicDataMultiSend extends MultiSend<PartitionDataSend> {
        protected TopicDataMultiSend(TopicData topicData, List<PartitionDataSend> sends) {
            super(sends);
            expectedBytesToWrite = topicData.sizeInBytes() - topicData.headerSize();
        }
    }

    public TopicDataSend(TopicData topicData) {
        this.topicData = topicData;
        size = topicData.sizeInBytes();

        buffer = ByteBuffer.allocate(topicData.headerSize());

        writeShortString(buffer, topicData.topic);
        buffer.putInt(topicData.partitionData.size());
        buffer.rewind();

        List<PartitionDataSend> sendData = Utils.mapList(topicData.partitionData,
                new Function2<Integer, FetchResponsePartitionData, PartitionDataSend>() {