@Override
    public void save(Savable object, File f, boolean createDirectories) throws IOException {
        File parentDirectory = f.getParentFile();
        if (parentDirectory != null && !parentDirectory.exists() && createDirectories) {
            parentDirectory.mkdirs();
        }

        FileOutputStream fos = new FileOutputStream(f);
        try {
            save(object, fos);
        } finally {
            fos.close();
        }
    }
Part of the jME XML IO system as introduced in the Google Code jmexml project.

@author Kai Rabien (hevee) - original author of the code.google.com jmexml project
@author Doug Daniels (dougnukem) - adjustments for jME 2.0 and Java 1.5
jme3-plugins/src/xml/java/com/jme3/export/xml/XMLExporter.java