use of org.apache.ignite.igfs.IgfsException in project ignite by apache.
the class LocalIgfsSecondaryFileSystem method create0.
/**
* Internal create routine.
*
* @param path Path.
* @param overwrite Overwrite flag.
* @return Output stream.
*/
private OutputStream create0(IgfsPath path, boolean overwrite) {
File file = fileForPath(path);
boolean exists = file.exists();
if (exists) {
if (!overwrite)
throw new IgfsPathAlreadyExistsException("Failed to create a file because it already exists: " + path);
} else {
File parent = file.getParentFile();
if (!mkdirs0(parent))
throw new IgfsException("Failed to create parent directory for file (underlying file system " + "returned false): " + path);
}
try {
return new FileOutputStream(file);
} catch (IOException e) {
throw handleSecondaryFsError(e, "Failed to create file [path=" + path + ", overwrite=" + overwrite + ']');
}
}
Aggregations