Here you can find the source of isPlaylistFile(Path testFile)
public static boolean isPlaylistFile(Path testFile)
//package com.java2s; //License from project: Open Source License import java.nio.file.Files; import java.nio.file.Path; public class Main { private static String[] playlistExtStrings = new String[] { "m3u" }; public static boolean isPlaylistFile(Path testFile) { String fileName = testFile.getFileName().toString(); if (!Files.exists(testFile)) { return false; } else if (!Files.isRegularFile(testFile)) { return false; } else if (fileName.lastIndexOf(".") == -1 || fileName.lastIndexOf(".") == 0) { return false; }// w w w .java2s .c o m String testExtension = fileName.substring(fileName.lastIndexOf(".") + 1).toLowerCase(); for (String playlistExtension : playlistExtStrings) { if (playlistExtension.toLowerCase().equals(testExtension)) { return true; } } return false; } }