@Test public void testAddExtension() { Assert.assertEquals("Wrong extension", "/a/b/c.txt.log", addExtension("/a/b/c.txt", ".log", false)); Assert.assertEquals("Wrong extension", "/a/b/c.log", addExtension("/a/b/c.txt", ".log", true)); Assert.assertEquals("Wrong extension", ".log", addExtension(".txt", ".log", true)); Assert.assertEquals("Wrong extension", ".txt.log", addExtension(".txt", ".log", false)); Assert.assertEquals("Wrong extension", ".", addExtension(".", ".txt", true)); Assert.assertEquals("Wrong extension", ".", addExtension(".", ".txt", false)); Assert.assertEquals("Wrong extension", "a.txt", addExtension("a.", ".txt", true)); }
public static String addExtension(String filename, final String newExtension, final boolean removeExistingExtension) { if (filename != null && filename.length() <= 1) { return filename; } LOGGER.debug("Received: {}.", filename); if (removeExistingExtension) { filename = removeExtension(filename); } LOGGER.debug("Returning: {}.", filename + newExtension); return filename + newExtension; }
IOUtils { public static String addExtension(String filename, final String newExtension, final boolean removeExistingExtension) { if (filename != null && filename.length() <= 1) { return filename; } LOGGER.debug("Received: {}.", filename); if (removeExistingExtension) { filename = removeExtension(filename); } LOGGER.debug("Returning: {}.", filename + newExtension); return filename + newExtension; } }
IOUtils { public static String addExtension(String filename, final String newExtension, final boolean removeExistingExtension) { if (filename != null && filename.length() <= 1) { return filename; } LOGGER.debug("Received: {}.", filename); if (removeExistingExtension) { filename = removeExtension(filename); } LOGGER.debug("Returning: {}.", filename + newExtension); return filename + newExtension; }  }
IOUtils { public static String addExtension(String filename, final String newExtension, final boolean removeExistingExtension) { if (filename != null && filename.length() <= 1) { return filename; } LOGGER.debug("Received: {}.", filename); if (removeExistingExtension) { filename = removeExtension(filename); } LOGGER.debug("Returning: {}.", filename + newExtension); return filename + newExtension; }  static Writable findInMapFile(final Text key, URI dirURI, final Configuration conf); @SuppressWarnings("resource") static URI createMapFile(URI inputURI, final Configuration conf); static URI compressFile(final URI uncompressedURI, final String codecName, final Configuration conf); static String addExtension(String filename, final String newExtension, final boolean removeExistingExtension); static String removeExtension(String filename); static URI uncompressFile(final URI archiveURI, final Configuration conf); }
IOUtils { public static String addExtension(String filename, final String newExtension, final boolean removeExistingExtension) { if (filename != null && filename.length() <= 1) { return filename; } LOGGER.debug("Received: {}.", filename); if (removeExistingExtension) { filename = removeExtension(filename); } LOGGER.debug("Returning: {}.", filename + newExtension); return filename + newExtension; }  static Writable findInMapFile(final Text key, URI dirURI, final Configuration conf); @SuppressWarnings("resource") static URI createMapFile(URI inputURI, final Configuration conf); static URI compressFile(final URI uncompressedURI, final String codecName, final Configuration conf); static String addExtension(String filename, final String newExtension, final boolean removeExistingExtension); static String removeExtension(String filename); static URI uncompressFile(final URI archiveURI, final Configuration conf); static final Logger LOGGER; }