FileUtils { public static String extractExtension(final Path file) { String name = file.getName(); int stopPosition = name.lastIndexOf("."); return stopPosition >= 0 ? name.substring(stopPosition + 1) : null; } private  FileUtils(); static List<Path> gatherFiles(final int depth,
                                         final String... inputPaths); static Path[] createPaths(final String... pathStrings); static List<Path> gatherFiles(final int depth,
                                         final Path... inputPaths); static Path ensureEmptyDirectory(final Path parentPath,
                                            final String name, final FileSystem fs); static void ensureEmptyDirectory(final Path path, FileSystem fs); static FileSystem ensureFileSystem(final Path path,
                                              final FileSystem fs); static boolean remove(final Path file, final boolean recursive); static InputStream open(final Path file, FileSystem fileSystem); static InflaterInputStreamFactory<?> findInflaterInputStreamFactory(Path file); static Path findCommonParentPath(Path path1, Path path2); static String findCommonParent(Collection<String> filePaths); static String extractExtension(final Path file); static Encoding detectEncoding(final Path file, FileSystem fileSystem, Encoding fallback,
                                          Reference<InputStream> gnawedInputStreamReference);  }
@Test public void testExtractExtension() { Collection<Tuple2<String, String>> testEntries = new LinkedList<>(); testEntries.add(new Tuple2<>("hdfs: testEntries.add(new Tuple2<>("hdfs: testEntries.add(new Tuple2<>("hdfs: testEntries.add(new Tuple2<>("hdfs: for (Tuple2<String, String> testEntry : testEntries) { Path path = new Path(testEntry.f0); String extension = FileUtils.extractExtension(path); Assert.assertEquals(testEntry.f1, extension); } }