public static <T> T withFileOutputStream(File file, ThrowingFunction<OutputStream, T> f) {
        makeDirectoriesRecursive(file.getParentFile());
        try (FileOutputStream fos = new FileOutputStream(file)) {
            return f.apply(fos);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }
Creates a new file and all its parent directories, and provides a file output stream to the file.
bundle-plugin/src/main/java/com/yahoo/container/plugin/util/IO.java