public static byte[] toByteArray(InputStream is) {
        try (ByteArrayOutputStream output = new ByteArrayOutputStream()) {
            byte[] b = new byte[BUFFER_SIZE];
            int n;
            while ((n = is.read(b)) != -1) {
                output.write(b, 0, n);
            }
            return output.toByteArray();
        } catch (IOException e) {
            throw new UncheckedIOException(e);
        }
    }
Reads and returns the rest of the given input stream as a byte array.
Caller is responsible for closing the given input stream.

@param is The input stream to convert.
@return The converted bytes.
smithy-utils/src/main/java/software/amazon/smithy/utils/IoUtils.java