Class FileNamingHelper


  • public class FileNamingHelper
    extends java.lang.Object
    Strips characters that are invalid (to the filesystem) on common OSes. Specifically - ASCII control characters 0-31, (including CR and LF) and "*:/|\<>?, as well as repeated periods. Duplicated as a single method in Catapult's FileUtil class
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String stripIllegalCharacters​(java.lang.String badfileName)
      Proxy for stripIllegalCharacters, with a null fallback
      static java.lang.String stripIllegalCharacters​(java.lang.String badFileName, java.lang.String fallback)
      Given an input string, returns a string with filesystem invalid characters removed
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • stripIllegalCharacters

        public static java.lang.String stripIllegalCharacters​(java.lang.String badfileName)
        Proxy for stripIllegalCharacters, with a null fallback
      • stripIllegalCharacters

        public static java.lang.String stripIllegalCharacters​(java.lang.String badFileName,
                                                              java.lang.String fallback)
        Given an input string, returns a string with filesystem invalid characters removed
        Parameters:
        badFileName - cannot be null
        fallback - will be used if stripping illegal characters results in an empty string
        Returns:
        a sanitized string suitable for use on the filesystem, or the fallback