Back to project page Visu.
The source code is released under:
Apache License
If you think the Android project Visu listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.samsung.sprc.fileselector; /*w w w . ja v a2 s . c om*/ import java.io.File; /** * A set of tools for file operations */ public class FileUtils { /** Filter which accepts every file */ public static final String FILTER_ALLOW_ALL = "*.*"; /** * This method checks that the file is accepted by the filter * * @param file * - file that will be checked if there is a specific type * @param filter * - criterion - the file type(for example ".jpg") * @return true - if file meets the criterion - false otherwise. */ public static boolean accept(final File file, final String filter) { if (filter.compareTo(FILTER_ALLOW_ALL) == 0) { return true; } if (file.isDirectory()) { return true; } int lastIndexOfPoint = file.getName().lastIndexOf('.'); if (lastIndexOfPoint == -1) { return false; } String fileType = file.getName().substring(lastIndexOfPoint).toLowerCase(); return fileType.compareTo(filter) == 0; } }