< prev index next >

src/java.base/share/classes/sun/nio/cs/StandardCharsets.java.template

Print this page
rev 14210 : 8154231: Simplify access to System properties from JDK code
Reviewed-by: rriggs


  17  *
  18  * You should have received a copy of the GNU General Public License version
  19  * 2 along with this work; if not, write to the Free Software Foundation,
  20  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  21  *
  22  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  23  * or visit www.oracle.com if you need additional information or have any
  24  * questions.
  25  *
  26  */
  27 
  28 // -- This file was mechanically generated: Do not edit! -- //
  29 
  30 package sun.nio.cs;
  31 
  32 import java.nio.charset.Charset;
  33 import java.nio.charset.spi.CharsetProvider;
  34 import java.util.Iterator;
  35 import java.util.Locale;
  36 import java.util.Map;
  37 import java.security.AccessController;
  38 import java.security.PrivilegedAction;
  39 
  40 public class StandardCharsets extends CharsetProvider {
  41 
  42     _INCLUDE_ALIASES_TABLES_
  43     _INCLUDE_ALIASES_MAP_
  44     _INCLUDE_CLASSES_MAP_
  45     _INCLUDE_CACHE_MAP_
  46 
  47     // Maps canonical names to class names
  48     private Map<String,String> classMap;
  49     // Maps alias names to canonical names
  50     private Map<String,String> aliasMap;
  51     // Maps canonical names to cached instances
  52     private Map<String,Charset> cache;
  53 
  54     private String packagePrefix = "sun.nio.cs";
  55 
  56     public StandardCharsets() {
  57         this.aliasMap = new Aliases();
  58         this.classMap = new Classes();


 184                         "x-sjis",
 185                         "csShiftJIS",
 186                         // This alias takes precedence over the actual
 187                         // Shift_JIS charset itself since aliases are always
 188                         // resolved first, before looking up canonical names.
 189                         "shift_jis"
 190                     };
 191                     aliases_SJIS = new String[] { "sjis" };
 192 
 193                     for (String alias : aliases_MS932) {
 194                         aliasMap.put(toLower(alias), "windows-31j");
 195                     }
 196                     cache.put("shift_jis", null);
 197                     break;
 198                 }
 199             }
 200         }
 201     }
 202 
 203     private static String getProperty(String key) {
 204         // this method may be called during initialization of
 205         // system class loader and thus not using lambda
 206         return AccessController.doPrivileged(
 207             new PrivilegedAction<String>() {
 208                 @Override
 209                 public String run() {
 210                     return System.getProperty(key);
 211                 }
 212             });
 213     }
 214 
 215 
 216 }


  17  *
  18  * You should have received a copy of the GNU General Public License version
  19  * 2 along with this work; if not, write to the Free Software Foundation,
  20  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  21  *
  22  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  23  * or visit www.oracle.com if you need additional information or have any
  24  * questions.
  25  *
  26  */
  27 
  28 // -- This file was mechanically generated: Do not edit! -- //
  29 
  30 package sun.nio.cs;
  31 
  32 import java.nio.charset.Charset;
  33 import java.nio.charset.spi.CharsetProvider;
  34 import java.util.Iterator;
  35 import java.util.Locale;
  36 import java.util.Map;
  37 import sun.security.action.GetPropertyAction;

  38 
  39 public class StandardCharsets extends CharsetProvider {
  40 
  41     _INCLUDE_ALIASES_TABLES_
  42     _INCLUDE_ALIASES_MAP_
  43     _INCLUDE_CLASSES_MAP_
  44     _INCLUDE_CACHE_MAP_
  45 
  46     // Maps canonical names to class names
  47     private Map<String,String> classMap;
  48     // Maps alias names to canonical names
  49     private Map<String,String> aliasMap;
  50     // Maps canonical names to cached instances
  51     private Map<String,Charset> cache;
  52 
  53     private String packagePrefix = "sun.nio.cs";
  54 
  55     public StandardCharsets() {
  56         this.aliasMap = new Aliases();
  57         this.classMap = new Classes();


 183                         "x-sjis",
 184                         "csShiftJIS",
 185                         // This alias takes precedence over the actual
 186                         // Shift_JIS charset itself since aliases are always
 187                         // resolved first, before looking up canonical names.
 188                         "shift_jis"
 189                     };
 190                     aliases_SJIS = new String[] { "sjis" };
 191 
 192                     for (String alias : aliases_MS932) {
 193                         aliasMap.put(toLower(alias), "windows-31j");
 194                     }
 195                     cache.put("shift_jis", null);
 196                     break;
 197                 }
 198             }
 199         }
 200     }
 201 
 202     private static String getProperty(String key) {
 203         return GetPropertyAction.getProperty(key);








 204     }
 205 
 206 
 207 }
< prev index next >