// Path: ersatz/src/main/java/io/github/cjstehno/ersatz/util/ByteArrays.java
// public static byte[] join(final List<byte[]> arrays) {
//     byte[] current = new byte[0];
// 
//     for (final byte[] array : arrays) {
//         current = join(current, array);
//     }
// 
//     return current;
// }


import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.net.URI;
import java.net.URL;
import java.nio.charset.Charset;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Base64;
import java.util.LinkedList;
import java.util.function.Function;
import static io.github.cjstehno.ersatz.util.ByteArrays.join;
import static java.nio.charset.StandardCharsets.UTF_8;
import static java.nio.file.Files.readAllBytes;

            throw new IllegalArgumentException(obj.getClass().getName() + " found, MultipartRequestContent is required.");
        }

        final ErsatzMultipartResponseContent mrc = (ErsatzMultipartResponseContent) obj;

        final var arrays = new LinkedList<byte[]>();

        mrc.parts().forEach(p -> {
            arrays.add(("--" + mrc.getBoundary() + "\r\n").getBytes(UTF_8));

            if (p.getFileName() != null) {
                arrays.add(("Content-Disposition: form-data; name=\"" + p.getFieldName() + "\"; filename=\"" + p.getFileName() + "\"\r\n").getBytes(UTF_8));
            } else {
                arrays.add(("Content-Disposition: form-data; name=\"" + p.getFieldName() + "\"\r\n").getBytes(UTF_8));
            }

            if (p.getTransferEncoding() != null) {
                arrays.add(("Content-Transfer-Encoding: " + p.getTransferEncoding() + "\r\n").getBytes(UTF_8));
            }

            arrays.add(("Content-Type: " + p.getContentType() + "\r\n\r\n").getBytes(UTF_8));

            final Function<Object, byte[]> encoderFn = mrc.encoder(p.getContentType(), p.getValue().getClass());
            final var encoded = encoderFn.apply(p.getValue());
            arrays.add(encoded);
            arrays.add("\r\n".getBytes(UTF_8));
        });

        arrays.add(("--" + mrc.getBoundary() + "--\r\n").getBytes(UTF_8));


// Path: ersatz/src/main/java/io/github/cjstehno/ersatz/util/ByteArrays.java
// public static byte[] join(final List<byte[]> arrays) {
//     byte[] current = new byte[0];
// 
//     for (final byte[] array : arrays) {
//         current = join(current, array);
//     }
// 
//     return current;
// }


// Path: ersatz/src/main/java/io/github/cjstehno/ersatz/encdec/Encoders.java
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.net.URI;
import java.net.URL;
import java.nio.charset.Charset;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Base64;
import java.util.LinkedList;
import java.util.function.Function;
import static io.github.cjstehno.ersatz.util.ByteArrays.join;
import static java.nio.charset.StandardCharsets.UTF_8;
import static java.nio.file.Files.readAllBytes;

            throw new IllegalArgumentException(obj.getClass().getName() + " found, MultipartRequestContent is required.");
        }

        final ErsatzMultipartResponseContent mrc = (ErsatzMultipartResponseContent) obj;

        final var arrays = new LinkedList<byte[]>();

        mrc.parts().forEach(p -> {
            arrays.add(("--" + mrc.getBoundary() + "\r\n").getBytes(UTF_8));

            if (p.getFileName() != null) {
                arrays.add(("Content-Disposition: form-data; name=\"" + p.getFieldName() + "\"; filename=\"" + p.getFileName() + "\"\r\n").getBytes(UTF_8));
            } else {
                arrays.add(("Content-Disposition: form-data; name=\"" + p.getFieldName() + "\"\r\n").getBytes(UTF_8));
            }

            if (p.getTransferEncoding() != null) {
                arrays.add(("Content-Transfer-Encoding: " + p.getTransferEncoding() + "\r\n").getBytes(UTF_8));
            }

            arrays.add(("Content-Type: " + p.getContentType() + "\r\n\r\n").getBytes(UTF_8));

            final Function<Object, byte[]> encoderFn = mrc.encoder(p.getContentType(), p.getValue().getClass());
            final var encoded = encoderFn.apply(p.getValue());
            arrays.add(encoded);
            arrays.add("\r\n".getBytes(UTF_8));
        });

        arrays.add(("--" + mrc.getBoundary() + "--\r\n").getBytes(UTF_8));


        return join(arrays);
