Path.newOutputStream((Set<? extends OpenOption> options, FileAttribute<?>... attrs) ?
Alan.Bateman at Sun.COM
Tue Nov 17 09:11:23 PST 2009
Vince Bonfanti wrote:
> Because Path.newOutputStream can create a new file, shouldn't there be
> an overload that accepts FileAttribute<?> arguments?
> I'm writing code that needs to set filesystem-specific attributes
> whenever a new file is created, but can't do this when creating a file
> with Path.newOutputStream.
It could be added if really needed - there is an assumption that it
won't be too common to want to set the initial attributes. At least with
the default provider, it is mainly for security related attributes.
Alternatives to consider would be to use createFile or use a channel, eg:
OutputStream out = file.createFile(attr).newOutputStream();
OutputStream out = Channels
More information about the nio-discuss