public static ByteBuffer[] generateBufferWithHeaders(
            List<Tuple2<Buffer, Integer>> bufferWithIndexes) {
        ByteBuffer[] bufferWithHeaders = new ByteBuffer[2 * bufferWithIndexes.size()];

        for (int i = 0; i < bufferWithIndexes.size(); i++) {
            Buffer buffer = bufferWithIndexes.get(i).f0;
            setBufferWithHeader(buffer, bufferWithHeaders, 2 * i);
        }
        return bufferWithHeaders;
    }
@Test
    void testGenerateBufferWithHeaders() {
        int bufferBytes = 5;
        Buffer originalBuffer = BufferBuilderTestUtils.buildSomeBuffer(bufferBytes);
        ByteBuffer header = BufferReaderWriterUtil.allocatedHeaderBuffer();
        BufferReaderWriterUtil.setByteChannelBufferHeader(originalBuffer, header);

        ByteBuffer[] byteBuffers =
                TieredStorageUtils.generateBufferWithHeaders(
                        Collections.singletonList(
                                new Tuple2<>(
                                        BufferBuilderTestUtils.buildSomeBuffer(bufferBytes), 0)));
        assertThat(byteBuffers).hasSize(2);
        assertThat(byteBuffers[0]).isEqualTo(header);
        assertThat(byteBuffers[1]).isEqualTo(originalBuffer.getNioBufferReadable());
    }