private static TransferableChannel toTransferableChannel(FileChannel channel) {
        return new TransferableChannel() {

            @Override
            public boolean hasPendingWrites() {
                return false;
            }

            @Override
            public long transferFrom(FileChannel fileChannel, long position, long count) throws IOException {
                return fileChannel.transferTo(position, count, channel);
            }

            @Override
            public boolean isOpen() {
                return channel.isOpen();
            }

            @Override
            public void close() throws IOException {
                channel.close();
            }

            @Override
            public int write(ByteBuffer src) throws IOException {
                return channel.write(src);
            }

            @Override
            public long write(ByteBuffer[] srcs, int offset, int length) throws IOException {
                return channel.write(srcs, offset, length);
            }

            @Override
            public long write(ByteBuffer[] srcs) throws IOException {
                return channel.write(srcs);
            }
        };
    }
Test the lazy down-conversion path.

If `overflow` is true, the number of bytes we want to convert is much larger
than the number of bytes we get after conversion. This causes overflow message batch(es) to be appended towards the
end of the converted output.
clients/src/test/java/org/apache/kafka/common/record/LazyDownConversionRecordsTest.java