if (exists(f) && !overwrite) {
throw new IOException("File already exists:" + f);
}
final Path parent = f.getParent();
if (parent != null && !mkdirs(parent)) {
throw new IOException("Mkdirs failed to create " + parent.toString());
}
final File file = pathToFile(f);
return new LocalDataOutputStream(file);
}