equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright 1997-1998 Sun Microsystems, Inc. All Rights Reserved. |
2 * Copyright 1996-2008 Sun Microsystems, Inc. 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. Sun designates this |
7 * published by the Free Software Foundation. Sun designates this |
27 |
27 |
28 /** |
28 /** |
29 * Tables and data to convert Unicode to JIS0201 |
29 * Tables and data to convert Unicode to JIS0201 |
30 * |
30 * |
31 * @author ConverterGenerator tool |
31 * @author ConverterGenerator tool |
|
32 * @version >= JDK1.1.6 |
32 */ |
33 */ |
33 |
34 |
34 class CharToByteJIS0201 extends CharToByteSingleByte { |
35 class CharToByteJIS0201 extends CharToByteSingleByte { |
35 |
36 |
36 public String getCharacterEncoding() { |
37 public String getCharacterEncoding() { |
39 |
40 |
40 public CharToByteJIS0201() { |
41 public CharToByteJIS0201() { |
41 super.mask1 = 0xFF00; |
42 super.mask1 = 0xFF00; |
42 super.mask2 = 0x00FF; |
43 super.mask2 = 0x00FF; |
43 super.shift = 8; |
44 super.shift = 8; |
|
45 /* |
44 super.index1 = index1; |
46 super.index1 = index1; |
45 super.index2 = index2; |
47 super.index2 = index2; |
|
48 */ |
|
49 } |
|
50 |
|
51 public byte getNative(char inputChar) { |
|
52 return (byte)index2.charAt(index1[(inputChar & mask1) >> shift] |
|
53 + (inputChar & mask2)); |
|
54 } |
|
55 |
|
56 public boolean canConvert(char ch) { |
|
57 if (index2.charAt(index1[((ch & mask1) >> shift)] + (ch & mask2)) != '\u0000') |
|
58 return true; |
|
59 return (ch == '\u0000'); |
46 } |
60 } |
47 |
61 |
48 private final static String index2 = |
62 private final static String index2 = |
49 |
63 |
50 "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" + |
64 "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" + |