< prev index next >

src/java.base/share/classes/sun/nio/cs/UTF_8.java

Print this page
8200310: Avoid charset lookup machinery in java.nio.charset.StandardCharsets
Reviewed-by: sherman


  38  *
  39  * #    Code Points      Bits   Bit/Byte pattern
  40  * 1                     7      0xxxxxxx
  41  *      U+0000..U+007F          00..7F
  42  *
  43  * 2                     11     110xxxxx    10xxxxxx
  44  *      U+0080..U+07FF          C2..DF      80..BF
  45  *
  46  * 3                     16     1110xxxx    10xxxxxx    10xxxxxx
  47  *      U+0800..U+0FFF          E0          A0..BF      80..BF
  48  *      U+1000..U+FFFF          E1..EF      80..BF      80..BF
  49  *
  50  * 4                     21     11110xxx    10xxxxxx    10xxxxxx    10xxxxxx
  51  *     U+10000..U+3FFFF         F0          90..BF      80..BF      80..BF
  52  *     U+40000..U+FFFFF         F1..F3      80..BF      80..BF      80..BF
  53  *    U+100000..U10FFFF         F4          80..8F      80..BF      80..BF
  54  *
  55  */
  56 
  57 public final class UTF_8 extends Unicode {
  58 
  59     public static final UTF_8 INSTANCE = new UTF_8();
  60 
  61     public UTF_8() {
  62         super("UTF-8", StandardCharsets.aliases_UTF_8());
  63     }
  64 
  65     public String historicalName() {
  66         return "UTF8";
  67     }
  68 
  69     public CharsetDecoder newDecoder() {
  70         return new Decoder(this);
  71     }
  72 
  73     public CharsetEncoder newEncoder() {
  74         return new Encoder(this);
  75     }
  76 
  77     static final void updatePositions(Buffer src, int sp,
  78                                               Buffer dst, int dp) {
  79         src.position(sp - src.arrayOffset());
  80         dst.position(dp - dst.arrayOffset());




  38  *
  39  * #    Code Points      Bits   Bit/Byte pattern
  40  * 1                     7      0xxxxxxx
  41  *      U+0000..U+007F          00..7F
  42  *
  43  * 2                     11     110xxxxx    10xxxxxx
  44  *      U+0080..U+07FF          C2..DF      80..BF
  45  *
  46  * 3                     16     1110xxxx    10xxxxxx    10xxxxxx
  47  *      U+0800..U+0FFF          E0          A0..BF      80..BF
  48  *      U+1000..U+FFFF          E1..EF      80..BF      80..BF
  49  *
  50  * 4                     21     11110xxx    10xxxxxx    10xxxxxx    10xxxxxx
  51  *     U+10000..U+3FFFF         F0          90..BF      80..BF      80..BF
  52  *     U+40000..U+FFFFF         F1..F3      80..BF      80..BF      80..BF
  53  *    U+100000..U10FFFF         F4          80..8F      80..BF      80..BF
  54  *
  55  */
  56 
  57 public final class UTF_8 extends Unicode {



  58     public UTF_8() {
  59         super("UTF-8", StandardCharsets.aliases_UTF_8());
  60     }
  61 
  62     public String historicalName() {
  63         return "UTF8";
  64     }
  65 
  66     public CharsetDecoder newDecoder() {
  67         return new Decoder(this);
  68     }
  69 
  70     public CharsetEncoder newEncoder() {
  71         return new Encoder(this);
  72     }
  73 
  74     static final void updatePositions(Buffer src, int sp,
  75                                               Buffer dst, int dp) {
  76         src.position(sp - src.arrayOffset());
  77         dst.position(dp - dst.arrayOffset());


< prev index next >