class FileUtils {

    public static void saveFile(Resource file, String text, boolean append) throws IOException {
        if(file.isDirectory()) {
            throw new IOException(file+": Is a directory");
        }

        try (OutputStream out = file.write(append);) {
            out.write(text.getBytes());
        }
    }

}