package org.codehaus.httpcache4j.util;

import java.io.*;
import java.util.function.Function;

public final class IOUtils {
    private static final int BUF_SIZE = 0x1000; // 4K
    private IOUtils() {
    }

    public static long copy(InputStream from, OutputStream to) throws IOException {
        if (from == null) {
            throw new IllegalArgumentException("null from not allowed");
        }
        if (to == null) {
            throw new IllegalArgumentException("null to not allowed");
        }
        byte[] buf = new byte[BUF_SIZE];
        long total = 0;
        while (true) {
            int r = from.read(buf);
            if (r == -1) {
                break;
            }
            to.write(buf, 0, r);
            total += r;
        }
        return total;
    }

    public static byte[] toByteArray(InputStream is) throws IOException {
        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        copy(is, bos);
        return bos.toByteArray();
    }

    public static <A extends Closeable, B> B borrow(A is, Function<A, B> f) {
        try(A p = is) {
            return f.apply(p);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
}

@@ -993,234 +993,7 @@
    %7D
-%0A%0A    public static %3CA extends Closeable, B%3E B borrow(A is, Function%3CA, B%3E f) %7B%0A        try(A p = is) %7B%0A            return f.apply(p);%0A        %7D catch (IOException e) %7B%0A            throw new RuntimeException(e);%0A        %7D%0A    %7D
 %0A%7D%0A

Remove unused code