@Override
protected void flushSpi() throws BackingStoreException
{
if ( !file.getParentFile().exists() && !file.getParentFile().mkdirs() )
{
throw new BackingStoreException("Could not create parent directories for: " + file);
}
OutputStream out = null;
try
{
out = new BufferedOutputStream(new FileOutputStream(file));
properties.store(out, "# Auto-generated by " + FileBasedPreferences.class.getName());
}
catch ( IOException e )
{
throw new BackingStoreException(e);
}
finally
{
Closeables.closeQuietly(out);
}