Class NormalizedFileNames


  • class NormalizedFileNames
    extends java.lang.Object
    Internal utility to create normalized file names from string ids. The file names generated by an instance of this class have the following properties:
    • The same input id is mapped to the same file name.
    • Different ids are mapped to different file names.
    • For safe characters the file name corresponds to the input id, other characters are replaced by _ (underscore).
    • File names are case aware, i.e. the same file name but with different upper/lower case characters is not possible.
    • If unique filenames can't directly created from the ids, additional suffixes are appended.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static java.util.BitSet LEGAL_CHARS  
      private java.util.Map<java.lang.String,​java.lang.String> mapping  
      private java.util.Set<java.lang.String> usedNames  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private java.lang.String ensureUniqueness​(java.lang.String s)  
      java.lang.String getFileName​(java.lang.String id)  
      private java.lang.String replaceIllegalChars​(java.lang.String s)  
      • Methods inherited from class java.lang.Object

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

      • LEGAL_CHARS

        private static final java.util.BitSet LEGAL_CHARS
      • mapping

        private final java.util.Map<java.lang.String,​java.lang.String> mapping
      • usedNames

        private final java.util.Set<java.lang.String> usedNames
    • Constructor Detail

      • NormalizedFileNames

        NormalizedFileNames()
    • Method Detail

      • getFileName

        public java.lang.String getFileName​(java.lang.String id)
      • replaceIllegalChars

        private java.lang.String replaceIllegalChars​(java.lang.String s)
      • ensureUniqueness

        private java.lang.String ensureUniqueness​(java.lang.String s)