source: trunk/gcc/libjava/gnu/gcj/runtime/FileDeleter.java

Last change on this file was 2, checked in by bird, 22 years ago

Initial revision

  • Property cvs2svn:cvs-rev set to 1.1
  • Property svn:eol-style set to native
  • Property svn:executable set to *
File size: 862 bytes
Line 
1/* Copyright (C) 2000 Free Software Foundation
2
3 This file is part of libgcj.
4
5This software is copyrighted work licensed under the terms of the
6Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
7details. */
8
9package gnu.gcj.runtime;
10
11import java.io.*;
12import java.util.*;
13
14public final class FileDeleter
15{
16 public synchronized static void add (File f)
17 {
18 if (deleteOnExitStack == null)
19 deleteOnExitStack = new Stack ();
20
21 deleteOnExitStack.push (f);
22 }
23
24 // Helper method called by java.lang.Runtime.exit() to perform
25 // pending deletions.
26 public synchronized static void deleteOnExitNow ()
27 {
28 if (deleteOnExitStack != null)
29 while (!deleteOnExitStack.empty ())
30 ((File)(deleteOnExitStack.pop ())).delete ();
31 }
32
33 // A stack of files to delete upon normal termination.
34 private static Stack deleteOnExitStack;
35}
Note: See TracBrowser for help on using the repository browser.