Path.createFile() and createDirectory() and nonexistent parents

Joel Uckelman uckelman at
Thu Oct 22 03:22:30 PDT 2009

I can't tell from the Javadoc for Path.createFile() and createDirectory()
what the expected behavior is if some element in the path (other than
the name) doesn't exist. For example, if my Path is /foo/bar, but /foo
doesn't exist, will calling Path.createFile() also create the directory
/foo or will it throw an IOException? The docs appear to leave this open;
it would be nice if they made a clear statement one way or the other,
since the current state makes it hard to know how to handle failure.


More information about the nio-dev mailing list