DELETE_ON_CLOSE question
Christian Ullenboom
ullenboom at googlemail.com
Fri Jul 31 07:35:16 PDT 2009
The documentation on DELETE_ON_CLOSE makes its clear that this option
is just a "best effort attempt to delete the file when closed by the
appropriate close method". But I expect somehow that the last exists()
return false and not true in the following example:
Path path = Paths.get( "opa.herbert.tmp" );
path.deleteIfExists();
System.out.println( path.exists() ); // false
path.newOutputStream().close();
System.out.println( path.exists() ); // true
path.newOutputStream( StandardOpenOption.DELETE_ON_CLOSE,
StandardOpenOption.SYNC ).close();
// File should be gone now, or?
System.out.println( path.exists() ); // true
I am using jdk-7-ea-bin-b67-windows-i586-30_jul_2009.
Thanks
Chris
More information about the nio-discuss
mailing list