KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > dbforms > devgui > FileUtility


1 /*
2  * $Header: /cvsroot/jdbforms/dbforms/src/org/dbforms/devgui/FileUtility.java,v 1.9 2005/02/19 21:26:29 hkollmann Exp $
3  * $Revision: 1.9 $
4  * $Date: 2005/02/19 21:26:29 $
5  *
6  * DbForms - a Rapid Application Development Framework
7  * Copyright (C) 2001 Joachim Peer <joepeer@excite.com>
8  *
9  * This library is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU Lesser General Public
11  * License as published by the Free Software Foundation; either
12  * version 2.1 of the License, or (at your option) any later version.
13  *
14  * This library is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17  * Lesser General Public License for more details.
18  *
19  * You should have received a copy of the GNU Lesser General Public
20  * License along with this library; if not, write to the Free Software
21  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22  */

23
24 package org.dbforms.devgui;
25
26 import java.io.*;
27
28
29
30 /**
31  * DOCUMENT ME!
32  *
33  * @author $author$
34  * @version $Revision: 1.9 $
35  */

36 public class FileUtility {
37    /**
38     * DOCUMENT ME!
39     *
40     * @param dir DOCUMENT ME!
41     * @param extensions DOCUMENT ME!
42     *
43     * @return DOCUMENT ME!
44     *
45     * @throws IOException DOCUMENT ME!
46     */

47    public static String JavaDoc[] getFileNamesInDirectory(File dir,
48                                                   String JavaDoc[] extensions) {
49       String JavaDoc [] res;
50       if (extensions == null) {
51          res = dir.list();
52       } else {
53          res = dir.list(new ExtensionFilter(extensions));
54       }
55       return res;
56    }
57
58
59    /**
60     * DOCUMENT ME!
61     *
62     * @param dir DOCUMENT ME!
63     * @param extensions DOCUMENT ME!
64     *
65     * @return DOCUMENT ME!
66     *
67     * @throws IOException DOCUMENT ME!
68     */

69    public static File[] getFilesInDirectory(File dir,
70                                             String JavaDoc[] extensions) {
71       File[] res;
72       if (extensions == null) {
73          res = dir.listFiles();
74       } else {
75          res = dir.listFiles(new ExtensionFilter(extensions));
76       }
77       return res;
78    }
79 }
80
Popular Tags