exists and notExists
Mark Thornton
mthornton at optrak.co.uk
Tue May 27 00:58:48 PDT 2008
Alan Bateman wrote:
> If we can't determine the file exists then the exists() method will
> return false. You cannot interpret this to mean the file does not
> exist. This is the reason for the notExists method. It's a trivial
> convenience method to allow you take action when it is confirmed that
> a file does not exit.
So in the case where existence can't be determined, both methods will
return false. I would prefer exists() to throw an exception which gave
the reason as accurately as possible. The existing File.delete() method
is very frustrating, as when it returns false there is a laundry list of
possible reasons but no clue as to which is true.
Mark Thornton
More information about the nio-discuss
mailing list