@Test public void testGetFileExtension() { assertNull(new Path("/a/b/c/").getFileExtension()); assertNull(new Path("/a/b/c").getFileExtension()); assertEquals("doc", new Path("/a/b/c.doc").getFileExtension()); }
public String getFileExtension() { if (hasTrailingSeparator()) { return null; } String lastSegment = lastSegment(); if (lastSegment == null) { return null; } int index = lastSegment.lastIndexOf('.'); if (index == -1) { return null; } return lastSegment.substring(index + 1); }
Path implements Serializable { public String getFileExtension() { if (hasTrailingSeparator()) { return null; } String lastSegment = lastSegment(); if (lastSegment == null) { return null; } int index = lastSegment.lastIndexOf('.'); if (index == -1) { return null; } return lastSegment.substring(index + 1); } }
Path implements Serializable { public String getFileExtension() { if (hasTrailingSeparator()) { return null; } String lastSegment = lastSegment(); if (lastSegment == null) { return null; } int index = lastSegment.lastIndexOf('.'); if (index == -1) { return null; } return lastSegment.substring(index + 1); } Path(String fullPath); private  Path(String[] segments, int separators); }
Path implements Serializable { public String getFileExtension() { if (hasTrailingSeparator()) { return null; } String lastSegment = lastSegment(); if (lastSegment == null) { return null; } int index = lastSegment.lastIndexOf('.'); if (index == -1) { return null; } return lastSegment.substring(index + 1); } Path(String fullPath); private  Path(String[] segments, int separators); static Path createFromAbsolutePath(String path); static Path createFromSegments(String[] segments); Path addFileExtension(String extension); Path addTrailingSeparator(); Path append(Path tail); Path append(String tail); @Override boolean equals(Object obj); @Override int hashCode(); String getFileExtension(); boolean hasTrailingSeparator(); boolean isAbsolute(); boolean isEmpty(); boolean isPrefixOf(Path anotherPath); boolean isRoot(); static boolean isValidPath(String path); String lastSegment(); Path makeAbsolute(); Path makeRelative(); int matchingFirstSegments(Path anotherPath); Path removeFileExtension(); Path removeFirstSegments(int count); Path removeLastSegments(final int count); Path removeTrailingSeparator(); String segment(int index); int segmentCount(); String[] segments(); @Override String toString(); Path uptoSegment(final int count); static String getFileNameFromPath(String iconPath); }
Path implements Serializable { public String getFileExtension() { if (hasTrailingSeparator()) { return null; } String lastSegment = lastSegment(); if (lastSegment == null) { return null; } int index = lastSegment.lastIndexOf('.'); if (index == -1) { return null; } return lastSegment.substring(index + 1); } Path(String fullPath); private  Path(String[] segments, int separators); static Path createFromAbsolutePath(String path); static Path createFromSegments(String[] segments); Path addFileExtension(String extension); Path addTrailingSeparator(); Path append(Path tail); Path append(String tail); @Override boolean equals(Object obj); @Override int hashCode(); String getFileExtension(); boolean hasTrailingSeparator(); boolean isAbsolute(); boolean isEmpty(); boolean isPrefixOf(Path anotherPath); boolean isRoot(); static boolean isValidPath(String path); String lastSegment(); Path makeAbsolute(); Path makeRelative(); int matchingFirstSegments(Path anotherPath); Path removeFileExtension(); Path removeFirstSegments(int count); Path removeLastSegments(final int count); Path removeTrailingSeparator(); String segment(int index); int segmentCount(); String[] segments(); @Override String toString(); Path uptoSegment(final int count); static String getFileNameFromPath(String iconPath);  }