@Test public void testCleanFilenameEmpty() { String dirty = ""; String clean = XmlCreator.cleanFilename(dirty, "Untitled"); Assert.assertEquals("Cleaned", "Untitled", clean); }
public static String cleanFilename(String fileName, String defaultName) { if (fileName == null || "".equals(fileName)) { fileName = defaultName; } else { fileName = fileName.replaceAll("\\W", ""); fileName = (fileName.length() > 0) ? fileName : defaultName; } return fileName; }
XmlCreator extends AsyncTask<Void, Integer, Uri> { public static String cleanFilename(String fileName, String defaultName) { if (fileName == null || "".equals(fileName)) { fileName = defaultName; } else { fileName = fileName.replaceAll("\\W", ""); fileName = (fileName.length() > 0) ? fileName : defaultName; } return fileName; } }
XmlCreator extends AsyncTask<Void, Integer, Uri> { public static String cleanFilename(String fileName, String defaultName) { if (fileName == null || "".equals(fileName)) { fileName = defaultName; } else { fileName = fileName.replaceAll("\\W", ""); fileName = (fileName.length() > 0) ? fileName : defaultName; } return fileName; } XmlCreator(Context context, Uri trackUri, String chosenFileName, ProgressListener listener); }
XmlCreator extends AsyncTask<Void, Integer, Uri> { public static String cleanFilename(String fileName, String defaultName) { if (fileName == null || "".equals(fileName)) { fileName = defaultName; } else { fileName = fileName.replaceAll("\\W", ""); fileName = (fileName.length() > 0) ? fileName : defaultName; } return fileName; } XmlCreator(Context context, Uri trackUri, String chosenFileName, ProgressListener listener); static String cleanFilename(String fileName, String defaultName); static boolean deleteRecursive(File file); static String convertStreamToString(InputStream is); static InputStream convertStreamToLoggedStream(String tag, InputStream is); void executeOn(Executor executor); void determineProgressGoal(); File getExportDirectoryPath(); void setExportDirectoryPath(File exportDirectoryPath); void quickTag(XmlSerializer serializer, String ns, String tag, String content); boolean needsBundling(); }
XmlCreator extends AsyncTask<Void, Integer, Uri> { public static String cleanFilename(String fileName, String defaultName) { if (fileName == null || "".equals(fileName)) { fileName = defaultName; } else { fileName = fileName.replaceAll("\\W", ""); fileName = (fileName.length() > 0) ? fileName : defaultName; } return fileName; } XmlCreator(Context context, Uri trackUri, String chosenFileName, ProgressListener listener); static String cleanFilename(String fileName, String defaultName); static boolean deleteRecursive(File file); static String convertStreamToString(InputStream is); static InputStream convertStreamToLoggedStream(String tag, InputStream is); void executeOn(Executor executor); void determineProgressGoal(); File getExportDirectoryPath(); void setExportDirectoryPath(File exportDirectoryPath); void quickTag(XmlSerializer serializer, String ns, String tag, String content); boolean needsBundling(); public ProgressAdmin mProgressAdmin; }