Here you can find the source of isValidFileType(Path filePath)
Parameter | Description |
---|---|
filePath | a Path instance representing a valid path |
public static boolean isValidFileType(Path filePath)
//package com.java2s; /**//from ww w .j a v a2s . c om * **************************************************************************** * Copyright (c) 2005-2014 Faur Ioan-Aurel. * * All rights reserved. This program and the accompanying materials * * are made available under the terms of the MIT License * * which accompanies this distribution, and is available at * * http://opensource.org/licenses/MIT * * * * For any issues or questions send an email at: fioan89@gmail.com * * ***************************************************************************** */ import java.nio.file.Path; public class Main { /** * A list of file types extensions that can be watched for different events like * creation, modification and remove. */ public static final String[] fileTypesToWatch = { ".class", ".properties" }; /** * Checks if the given file path is valid for monitoring (i.e is a class or resource file). * * @param filePath a {@link Path} instance representing a valid path * @return {@code true} if the file is a class file or a resource file, {@code false} otherwise */ public static boolean isValidFileType(Path filePath) { for (String fileType : fileTypesToWatch) { if (filePath != null && filePath.getFileName().toString().endsWith(fileType)) { return true; } } return false; } }