package org.mitallast.queue.benchmark;

import io.netty.buffer.ByteBuf;
import org.mitallast.queue.common.stream.StreamInput;
import org.mitallast.queue.common.stream.StreamOutput;
import org.mitallast.queue.common.stream.Streamable;

import java.io.IOException;

public class BenchmarkRequest implements Streamable {
    private final long request;
    private final byte[] data;

    public BenchmarkRequest(long request, byte[] data) {
        this.request = request;
        this.data = data;
    }

    public BenchmarkRequest(StreamInput stream) throws IOException {
        this.request = stream.readLong();
        int size = stream.readInt();
        if (size > 0) {
            this.data = new byte[size];
            stream.readFully(this.data);
        } else {
            this.data = new byte[0];
        }
    }

    @Override
    public void writeTo(StreamOutput stream) throws IOException {
        stream.writeLong(request);
        stream.write(data.length);
        if (data.length > 0) {
            stream.write(data);
        }
    }

    public long getRequest() {
        return request;
    }

    public byte[] getData() {
        return data;
    }
}

@@ -37,40 +37,8 @@
 k;%0A%0A
-import io.netty.buffer.ByteBuf;%0A
 impo
@@ -920,24 +920,27 @@
 stream.write
+Int
 (data.length

refactor benchmark service