public static void streamEncrypt(InputStream input, OutputStream output, AeadCipher cipher, boolean compressZstd) throws IOException {
        try (var out = maybeWrapCompress(cipher.wrapOutputStream(output), compressZstd)) {
            input.transferTo(out);
            out.flush();
        }
    }
Streams the contents of an input stream into an output stream after being wrapped by the input cipher.
Depending on the Cipher mode, this either encrypts a plaintext stream into ciphertext,
or decrypts a ciphertext stream into plaintext.

@param input source stream to read from
@param output destination stream to write to
@param cipher an {@link AeadCipher} created for either encryption or decryption
@throws IOException if any file operation fails
vespaclient-java/src/main/java/com/yahoo/vespa/security/tool/crypto/CipherUtils.java