File.java (deleteOnExit): New method.
* java/io/File.java (deleteOnExit): New method. * gnu/gcj/runtime/FileDeleter.java: New class. * java/lang/natRuntime.cc (exit): Call FileDeleter.deleteOnExitNow() * Makefile.am: Add FileDeleter.java. * Makefile.in: Rebuilt. From-SVN: r36141
This commit is contained in:
parent
4993ddc14f
commit
890a31f478
5 changed files with 60 additions and 2 deletions
|
@ -10,6 +10,9 @@ details. */
|
|||
|
||||
package java.io;
|
||||
|
||||
import java.util.*;
|
||||
import gnu.gcj.runtime.FileDeleter;
|
||||
|
||||
/**
|
||||
* @author Tom Tromey <tromey@cygnus.com>
|
||||
* @date September 24, 1998
|
||||
|
@ -42,7 +45,7 @@ public class File implements Serializable
|
|||
return access (p, WRITE);
|
||||
}
|
||||
|
||||
private final native boolean performDelete (String canon);
|
||||
private final native static boolean performDelete (String canon);
|
||||
public boolean delete ()
|
||||
{
|
||||
SecurityManager s = System.getSecurityManager();
|
||||
|
@ -347,6 +350,17 @@ public class File implements Serializable
|
|||
return p;
|
||||
}
|
||||
|
||||
// Add this File to the set of files to be deleted upon normal
|
||||
// termination.
|
||||
public void deleteOnExit ()
|
||||
{
|
||||
SecurityManager sm = System.getSecurityManager ();
|
||||
if (sm != null)
|
||||
sm.checkDelete (getName ());
|
||||
|
||||
FileDeleter.add (this);
|
||||
}
|
||||
|
||||
// QUERY arguments to access function.
|
||||
private final static int READ = 0;
|
||||
private final static int WRITE = 1;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue