source:
trunk/src/gcc/libjava/gnu/gcj/runtime/FileDeleter.java@
765
| Last change on this file since 765 was 2, checked in by , 23 years ago | |
|---|---|
|
|
| File size: 862 bytes | |
| Line | |
|---|---|
| 1 | /* Copyright (C) 2000 Free Software Foundation |
| 2 | |
| 3 | This file is part of libgcj. |
| 4 | |
| 5 | This software is copyrighted work licensed under the terms of the |
| 6 | Libgcj License. Please consult the file "LIBGCJ_LICENSE" for |
| 7 | details. */ |
| 8 | |
| 9 | package gnu.gcj.runtime; |
| 10 | |
| 11 | import java.io.*; |
| 12 | import java.util.*; |
| 13 | |
| 14 | public 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.
