2003-12-26 Guilhem Lavaux <guilhem@kaffe.org>
[official-gcc.git] / libjava / gnu / gcj / runtime / FileDeleter.java
blobd5f99d04c4712e457b8b0b57d36a454b62e888dd
1 /* Copyright (C) 2000 Free Software Foundation
3 This file is part of libgcj.
5 This software is copyrighted work licensed under the terms of the
6 Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
7 details. */
9 package gnu.gcj.runtime;
11 import java.io.*;
12 import java.util.*;
14 public final class FileDeleter
16 public synchronized static void add (File f)
18 if (deleteOnExitStack == null)
19 deleteOnExitStack = new Stack ();
21 deleteOnExitStack.push (f);
24 // Helper method called by java.lang.Runtime.exit() to perform
25 // pending deletions.
26 public synchronized static void deleteOnExitNow ()
28 if (deleteOnExitStack != null)
29 while (!deleteOnExitStack.empty ())
30 ((File)(deleteOnExitStack.pop ())).delete ();
33 // A stack of files to delete upon normal termination.
34 private static Stack deleteOnExitStack;