/* * [BookMacroFileFilter.java] * * Summary: Filters accepting files of form 9789999999999.html. * * Copyright: (c) 2012-2017 Roedy Green, Canadian Mind Products, http://mindprod.com * * Licence: This software may be copied and used freely for any purpose but military. * http://mindprod.com/contact/nonmil.html * * Requires: JDK 1.8+ * * Created with: JetBrains IntelliJ IDEA IDE http://www.jetbrains.com/idea/ * * Version History: * 1.0 2012-03-12 initial version */ package com.mindprod.stores; import java.io.File; import java.io.FilenameFilter; /** * Filters accepting files of form 9789999999999.html. * * @author Roedy Green, Canadian Mind Products * @version 1.0 2012-03-12 initial version * @since 2012-03-12 */ final public class BookMacroFileFilter implements FilenameFilter { /** * Select only files with appropriate length. * * @param dir the directory in which the file was found. * @param name the name of the file * * @return true if and only if the name should be included in the file list; false otherwise. */ public boolean accept( File dir, String name ) { final File file = new File( dir, name ); return file.isFile() && name.length() == 13 + 5 && name.startsWith( "97" ) && name.endsWith( ".html" ); } }