/***************************************************************************** * $Id: NameFilter.java,v 1.1.1.1 2000/03/29 22:58:15 kkeys Exp $ * * File: NameFilter.java Name: NameFilter * Goal: To create a filter that accepts only files that end with .fvl. * * Written: Bradley Huffaker (01/13/98) * For: Cooperative Association for Internet Data Analysis ****************************************************************************** ****************************************************************************** By accessing this software, NAMEFILTER, you are duly informed of and agree to be bound by the conditions described below in this notice: This software product, NAMEFILTER, is developed by Bradley Huffaker, and Jaeyeon Jung copyrighted(C) 1998 by the University of California, San Diego (UCSD), with all rights reserved. UCSD administers the NLANR Cache grants, NCR-9796082 and NCR-9616602, under which most of this code was developed. There is no charge for NAMEFILTER software. You can redistribute it and/or modify it under the terms of the GNU General Public License, v. 2 dated June 1991 which is incorporated by reference herein. NAMEFILTER is distributed WITHOUT ANY WARRANTY, IMPLIED OR EXPRESS, OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE or that the use of it will not infringe on any third party's intellectual property rights. You should have received a copy of the GNU GPL along with the NAMEFILTER program. Copies can also be obtained from http://www.gnu.org/copyleft/gpl.html or by writing to University of California, San Diego SDSC/CAIDA/NLANR 9500 Gilman Dr., MS-0505 La Jolla, CA 92093 - 0505 USA Or contact INFO@NLANR.NET *****************************************************************************/ package bhuffake.plankton; import java.awt.*; import java.io.FilenameFilter; import java.io.File; public class NameFilter implements FilenameFilter { public boolean accept(File dir, String name) { char[] array = name.toCharArray(); int index=array.length-1; if (index < 0 || array[index--] != 'l') return false; if (index < 0 || array[index--] != 'v') return false; if (index < 0 || array[index--] != 'f') return false; if (index < 0 || array[index--] != '.') return false; return true; } }