Bug in Files.copy() where the source Path is a directory... It _is_ a bug, right?

Alan Bateman Alan.Bateman at oracle.com
Thu Dec 11 10:33:24 UTC 2014


On 10/12/2014 22:06, Francis Galiegue wrote:
> :
>
> Even in the latest JDK, for instance FileInputStream won't accept any
> Path arguments; a ProcessBuilder won't allow to redirect to a Path,
> only to a File. Is this on purpose?
>
FileInputStream has methods such as getFD and getChannel that might not 
make sense to anything excepts files in the platform file system. 
Anything with a Path can easily call Files.newInputStream, assuming what 
it is doing doesn't require anything more specific than an InputStream.

The ProcessBuilder.redirectXXX methods are a case where maybe we should 
have used Path (sometimes it's hard to make wide spread use of new APIs 
in the release where they are introduced). However, these methods should 
likely need to fail when the Path is not associated with the default 
provider, it would likely not be feasible to redirect process input or 
output to files in arbitrary file systems without a forwarding mechanism.

In general I think it's a bit of a slow burner, in time there will 
likely be more APIs in the platform using the newer API.

-Alan.






More information about the nio-dev mailing list