public static OutputStream getFileOutputStream(String file) throws IOException {
        Path path = Paths.get(ClickHouseChecker.nonBlank(file, "file"));

        if (Files.notExists(path)) {
            Files.createDirectories(path.getParent());
            Files.createFile(path);
        }

        return new FileOutputStream(file, false);
    }
Get output stream for writing a file. Directories and file will be created if
they do not exist.

@param file path to the file
@return output stream
@throws IOException when failed to create directories and/or file
clickhouse-data/src/main/java/com/clickhouse/data/ClickHouseUtils.java