KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > ixenon > free > nodes > AllRegularFilenameFilter


1 /* $Id$
2  *
3  * Copyright (c) 1999 Xenonsoft Limited. All Rights Reserved.
4  *
5  * This software is protected by copyright. You are hereby notified from
6  * now by reading this message. This software is also the confidential
7  * and proprietary information of Xenonsoft Limited. ("Confidential
8  * Information").
9  *
10  * This software is distributed under the Xenonsoft Public end user
11  * License ("XPeL"), where the machine-readable source code is provided
12  * under the "Open Source" model.
13  * For more information, please read the file "LICENSE-XPL.txt"
14  */

15
16 // SimpleFilenameFilter.java
17

18 // Description:
19
// Installer frame for free installer application
20
//
21
// Author:
22
// Peter Pilgrim
23
// Tue Jan 26 20:08:37 GMT 1999
24
//
25
// RCS HEADER
26
//
27
// $Author$
28
// $Date$
29
// $Source$
30
// $Revision$ $State$ $Locker$
31
//
32
// History
33
// ================================================================================
34
// $Log$
35

36 package ixenon.free.nodes;
37
38 import java.io.*;
39 import java.util.*;
40
41 /** A filename filter which matching any regular files.
42  * Please note: filenames rejected include `.' and `..' also.
43  */

44 public class AllRegularFilenameFilter implements FilenameFilter
45 {
46     /**
47      * Create a filename filter which matching any regular files.
48      */

49     public AllRegularFilenameFilter() { /*Empty*/ }
50     
51     /** The <B>accept</B> method which determine if filename
52      * is reasonable or not.
53      * @param dir the <code>File</code> object representing the directory.
54      * @param name the filename.
55      */

56     public boolean accept(File dir, String JavaDoc name) {
57     File file = new File( dir, name );
58
59     if (!file.isFile() )
60         return (false);
61     if (name.equals(".") || name.equals(".."))
62         return (false);
63     return (true);
64     }
65 }
66
67 // fini
68
Popular Tags