Class CodeSetCache


  • class CodeSetCache
    extends java.lang.Object
    Thread local cache of sun.io code set converters for performance. The thread local class contains a single reference to a Map[] containing two WeakHashMaps. One for CharsetEncoders and one for CharsetDecoders. Constants are defined for indexing. This is used internally by CodeSetConversion.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.lang.ThreadLocal<java.util.WeakHashMap<java.lang.String,​java.nio.charset.CharsetDecoder>> btcMapLocal  
      private java.lang.ThreadLocal<java.util.WeakHashMap<java.lang.String,​java.nio.charset.CharsetEncoder>> ctbMapLocal  
    • Constructor Summary

      Constructors 
      Constructor Description
      CodeSetCache()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      (package private) java.nio.charset.CharsetDecoder getByteToCharConverter​(java.lang.String key)
      Retrieve a CharsetDecoder from the Map using the given key.
      (package private) java.nio.charset.CharsetEncoder getCharToByteConverter​(java.lang.String key)
      Retrieve a CharsetEncoder from the Map using the given key.
      (package private) java.nio.charset.CharsetDecoder setConverter​(java.lang.String key, java.nio.charset.CharsetDecoder converter)
      Stores the given CharsetDecoder in the thread local cache, and returns the same converter.
      (package private) java.nio.charset.CharsetEncoder setConverter​(java.lang.String key, java.nio.charset.CharsetEncoder converter)
      Stores the given CharsetEncoder in the thread local cache, and returns the same converter.
      • Methods inherited from class java.lang.Object

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

      • ctbMapLocal

        private java.lang.ThreadLocal<java.util.WeakHashMap<java.lang.String,​java.nio.charset.CharsetEncoder>> ctbMapLocal
      • btcMapLocal

        private java.lang.ThreadLocal<java.util.WeakHashMap<java.lang.String,​java.nio.charset.CharsetDecoder>> btcMapLocal
    • Constructor Detail

      • CodeSetCache

        CodeSetCache()
    • Method Detail

      • getByteToCharConverter

        java.nio.charset.CharsetDecoder getByteToCharConverter​(java.lang.String key)
        Retrieve a CharsetDecoder from the Map using the given key.
      • getCharToByteConverter

        java.nio.charset.CharsetEncoder getCharToByteConverter​(java.lang.String key)
        Retrieve a CharsetEncoder from the Map using the given key.
      • setConverter

        java.nio.charset.CharsetDecoder setConverter​(java.lang.String key,
                                                     java.nio.charset.CharsetDecoder converter)
        Stores the given CharsetDecoder in the thread local cache, and returns the same converter.
      • setConverter

        java.nio.charset.CharsetEncoder setConverter​(java.lang.String key,
                                                     java.nio.charset.CharsetEncoder converter)
        Stores the given CharsetEncoder in the thread local cache, and returns the same converter.