jdk/src/share/classes/sun/nio/cs/ext/SJIS_0213.java
changeset 12431 bd2ef6b4190e
parent 5506 202f599c92aa
equal deleted inserted replaced
12430:bd6e432b84ad 12431:bd2ef6b4190e
     1 /*
     1 /*
     2  * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     7  * published by the Free Software Foundation.  Oracle designates this
    29 import java.nio.CharBuffer;
    29 import java.nio.CharBuffer;
    30 import java.nio.charset.Charset;
    30 import java.nio.charset.Charset;
    31 import java.nio.charset.CharsetEncoder;
    31 import java.nio.charset.CharsetEncoder;
    32 import java.nio.charset.CharsetDecoder;
    32 import java.nio.charset.CharsetDecoder;
    33 import java.nio.charset.CoderResult;
    33 import java.nio.charset.CoderResult;
       
    34 import java.security.AccessController;
       
    35 import java.security.PrivilegedAction;
    34 import java.util.Arrays;
    36 import java.util.Arrays;
    35 import sun.nio.cs.CharsetMapping;
    37 import sun.nio.cs.CharsetMapping;
    36 
    38 
    37 /*
    39 /*
    38  *  5 types of entry in SJIS_X_0213/Unicode mapping table
    40  *  5 types of entry in SJIS_X_0213/Unicode mapping table
    71 
    73 
    72     public CharsetEncoder newEncoder() {
    74     public CharsetEncoder newEncoder() {
    73         return new Encoder(this);
    75         return new Encoder(this);
    74     }
    76     }
    75 
    77 
    76     static CharsetMapping mapping =
    78     static CharsetMapping mapping = AccessController.doPrivileged(
    77         CharsetMapping.get(SJIS_0213.class.getResourceAsStream("sjis0213.dat"));
    79         new PrivilegedAction<CharsetMapping>() {
       
    80             public CharsetMapping run() {
       
    81                 return CharsetMapping.get(SJIS_0213.class.getResourceAsStream("sjis0213.dat"));
       
    82             }
       
    83         });
    78 
    84 
    79     protected static class Decoder extends CharsetDecoder {
    85     protected static class Decoder extends CharsetDecoder {
    80         protected static final char UNMAPPABLE = CharsetMapping.UNMAPPABLE_DECODING;
    86         protected static final char UNMAPPABLE = CharsetMapping.UNMAPPABLE_DECODING;
    81 
    87 
    82         protected Decoder(Charset cs) {
    88         protected Decoder(Charset cs) {