@Test public void testSplit() { final Object[][] testParameters = new Object[][] {{"/Pictures/hello.jpg", new String[] {"/Pictures", "hello", "jpg"}}, {"/tester/Desktop/study/blockchain.pdf", new String[] {"/tester/Desktop/study", "blockchain", "pdf"}}}; assertNull(FilepathUtils.split(null)); for (final Object[] testParameter : testParameters) { String[] expected = (String[]) testParameter[1]; String path = (String) testParameter[0]; for (int i = 0; i < expected.length; ++i) { assertEquals(expected[i], FilepathUtils.split(path)[i]); } } }
public static String[] split(final String path) { if (null == path) { return null; } final String parent = getParentPath(path); final String filename = getFilename(path); final String name = FilenameUtils.stripExtension(filename); final String ext = FilenameUtils.getExtension(filename); return new String[] {parent, name, ext}; }
FilepathUtils { public static String[] split(final String path) { if (null == path) { return null; } final String parent = getParentPath(path); final String filename = getFilename(path); final String name = FilenameUtils.stripExtension(filename); final String ext = FilenameUtils.getExtension(filename); return new String[] {parent, name, ext}; } }
FilepathUtils { public static String[] split(final String path) { if (null == path) { return null; } final String parent = getParentPath(path); final String filename = getFilename(path); final String name = FilenameUtils.stripExtension(filename); final String ext = FilenameUtils.getExtension(filename); return new String[] {parent, name, ext}; }  }
FilepathUtils { public static String[] split(final String path) { if (null == path) { return null; } final String parent = getParentPath(path); final String filename = getFilename(path); final String name = FilenameUtils.stripExtension(filename); final String ext = FilenameUtils.getExtension(filename); return new String[] {parent, name, ext}; }  static String[] getCanonicalFragments(final String path); static String getCanonicalForm(final String path); static String[] split(final String path); static String getParentPath(final String path); static String getFilename(final String path); static String concat(final String... fragments); static String append(final String... fragments); static String append(final String[] fragments, final int start, final int end); }
FilepathUtils { public static String[] split(final String path) { if (null == path) { return null; } final String parent = getParentPath(path); final String filename = getFilename(path); final String name = FilenameUtils.stripExtension(filename); final String ext = FilenameUtils.getExtension(filename); return new String[] {parent, name, ext}; }  static String[] getCanonicalFragments(final String path); static String getCanonicalForm(final String path); static String[] split(final String path); static String getParentPath(final String path); static String getFilename(final String path); static String concat(final String... fragments); static String append(final String... fragments); static String append(final String[] fragments, final int start, final int end);  }