5ebeb9b7f10a21d3def8f79194e92c7e34c8140d
[jSite.git] / src / de / todesbaum / util / io / TempFileInputStream.java
1 /*
2  * todesbaum-lib -
3  * Copyright (C) 2006 David Roden
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18  */
19
20 package de.todesbaum.util.io;
21
22 import java.io.File;
23 import java.io.FileInputStream;
24 import java.io.FileNotFoundException;
25 import java.io.IOException;
26
27 /**
28  * @author David Roden <droden@gmail.com>
29  * @version $Id$
30  */
31 public class TempFileInputStream extends FileInputStream {
32
33         private File tempFile;
34
35         /**
36          * @param name
37          * @throws FileNotFoundException
38          */
39         public TempFileInputStream(String name) throws FileNotFoundException {
40                 this(new File(name));
41         }
42
43         /**
44          * @param file
45          * @throws FileNotFoundException
46          */
47         public TempFileInputStream(File file) throws FileNotFoundException {
48                 super(file);
49                 tempFile = file;
50         }
51
52         @Override
53         public void close() throws IOException {
54                 super.close();
55                 tempFile.delete();
56         }
57
58 }