author | sherman |
Fri, 19 Jun 2009 14:39:06 -0700 | |
changeset 3052 | 5c9886498f31 |
child 5506 | 202f599c92aa |
permissions | -rw-r--r-- |
3052
5c9886498f31
6299219: euro sign failed to be printed in Console on Localized Windows platform with GBK encoding
sherman
parents:
diff
changeset
|
1 |
/* |
5c9886498f31
6299219: euro sign failed to be printed in Console on Localized Windows platform with GBK encoding
sherman
parents:
diff
changeset
|
2 |
* Copyright 1999-2005 Sun Microsystems, Inc. All Rights Reserved. |
5c9886498f31
6299219: euro sign failed to be printed in Console on Localized Windows platform with GBK encoding
sherman
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
5c9886498f31
6299219: euro sign failed to be printed in Console on Localized Windows platform with GBK encoding
sherman
parents:
diff
changeset
|
4 |
* |
5c9886498f31
6299219: euro sign failed to be printed in Console on Localized Windows platform with GBK encoding
sherman
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
5c9886498f31
6299219: euro sign failed to be printed in Console on Localized Windows platform with GBK encoding
sherman
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
5c9886498f31
6299219: euro sign failed to be printed in Console on Localized Windows platform with GBK encoding
sherman
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. Sun designates this |
5c9886498f31
6299219: euro sign failed to be printed in Console on Localized Windows platform with GBK encoding
sherman
parents:
diff
changeset
|
8 |
* particular file as subject to the "Classpath" exception as provided |
5c9886498f31
6299219: euro sign failed to be printed in Console on Localized Windows platform with GBK encoding
sherman
parents:
diff
changeset
|
9 |
* by Sun in the LICENSE file that accompanied this code. |
5c9886498f31
6299219: euro sign failed to be printed in Console on Localized Windows platform with GBK encoding
sherman
parents:
diff
changeset
|
10 |
* |
5c9886498f31
6299219: euro sign failed to be printed in Console on Localized Windows platform with GBK encoding
sherman
parents:
diff
changeset
|
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
5c9886498f31
6299219: euro sign failed to be printed in Console on Localized Windows platform with GBK encoding
sherman
parents:
diff
changeset
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
5c9886498f31
6299219: euro sign failed to be printed in Console on Localized Windows platform with GBK encoding
sherman
parents:
diff
changeset
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
5c9886498f31
6299219: euro sign failed to be printed in Console on Localized Windows platform with GBK encoding
sherman
parents:
diff
changeset
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that |
5c9886498f31
6299219: euro sign failed to be printed in Console on Localized Windows platform with GBK encoding
sherman
parents:
diff
changeset
|
15 |
* accompanied this code). |
5c9886498f31
6299219: euro sign failed to be printed in Console on Localized Windows platform with GBK encoding
sherman
parents:
diff
changeset
|
16 |
* |
5c9886498f31
6299219: euro sign failed to be printed in Console on Localized Windows platform with GBK encoding
sherman
parents:
diff
changeset
|
17 |
* You should have received a copy of the GNU General Public License version |
5c9886498f31
6299219: euro sign failed to be printed in Console on Localized Windows platform with GBK encoding
sherman
parents:
diff
changeset
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation, |
5c9886498f31
6299219: euro sign failed to be printed in Console on Localized Windows platform with GBK encoding
sherman
parents:
diff
changeset
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
5c9886498f31
6299219: euro sign failed to be printed in Console on Localized Windows platform with GBK encoding
sherman
parents:
diff
changeset
|
20 |
* |
5c9886498f31
6299219: euro sign failed to be printed in Console on Localized Windows platform with GBK encoding
sherman
parents:
diff
changeset
|
21 |
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, |
5c9886498f31
6299219: euro sign failed to be printed in Console on Localized Windows platform with GBK encoding
sherman
parents:
diff
changeset
|
22 |
* CA 95054 USA or visit www.sun.com if you need additional information or |
5c9886498f31
6299219: euro sign failed to be printed in Console on Localized Windows platform with GBK encoding
sherman
parents:
diff
changeset
|
23 |
* have any questions. |
5c9886498f31
6299219: euro sign failed to be printed in Console on Localized Windows platform with GBK encoding
sherman
parents:
diff
changeset
|
24 |
*/ |
5c9886498f31
6299219: euro sign failed to be printed in Console on Localized Windows platform with GBK encoding
sherman
parents:
diff
changeset
|
25 |
|
5c9886498f31
6299219: euro sign failed to be printed in Console on Localized Windows platform with GBK encoding
sherman
parents:
diff
changeset
|
26 |
|
5c9886498f31
6299219: euro sign failed to be printed in Console on Localized Windows platform with GBK encoding
sherman
parents:
diff
changeset
|
27 |
import java.nio.charset.Charset; |
5c9886498f31
6299219: euro sign failed to be printed in Console on Localized Windows platform with GBK encoding
sherman
parents:
diff
changeset
|
28 |
import java.nio.charset.CharsetEncoder; |
5c9886498f31
6299219: euro sign failed to be printed in Console on Localized Windows platform with GBK encoding
sherman
parents:
diff
changeset
|
29 |
import java.nio.charset.CharsetDecoder; |
5c9886498f31
6299219: euro sign failed to be printed in Console on Localized Windows platform with GBK encoding
sherman
parents:
diff
changeset
|
30 |
import sun.nio.cs.ext.GBK; |
5c9886498f31
6299219: euro sign failed to be printed in Console on Localized Windows platform with GBK encoding
sherman
parents:
diff
changeset
|
31 |
|
5c9886498f31
6299219: euro sign failed to be printed in Console on Localized Windows platform with GBK encoding
sherman
parents:
diff
changeset
|
32 |
public class X11GBK_OLD extends Charset { |
5c9886498f31
6299219: euro sign failed to be printed in Console on Localized Windows platform with GBK encoding
sherman
parents:
diff
changeset
|
33 |
public X11GBK_OLD () { |
5c9886498f31
6299219: euro sign failed to be printed in Console on Localized Windows platform with GBK encoding
sherman
parents:
diff
changeset
|
34 |
super("X11GBK-OLD", null); |
5c9886498f31
6299219: euro sign failed to be printed in Console on Localized Windows platform with GBK encoding
sherman
parents:
diff
changeset
|
35 |
} |
5c9886498f31
6299219: euro sign failed to be printed in Console on Localized Windows platform with GBK encoding
sherman
parents:
diff
changeset
|
36 |
public CharsetEncoder newEncoder() { |
5c9886498f31
6299219: euro sign failed to be printed in Console on Localized Windows platform with GBK encoding
sherman
parents:
diff
changeset
|
37 |
return new Encoder(this); |
5c9886498f31
6299219: euro sign failed to be printed in Console on Localized Windows platform with GBK encoding
sherman
parents:
diff
changeset
|
38 |
} |
5c9886498f31
6299219: euro sign failed to be printed in Console on Localized Windows platform with GBK encoding
sherman
parents:
diff
changeset
|
39 |
public CharsetDecoder newDecoder() { |
5c9886498f31
6299219: euro sign failed to be printed in Console on Localized Windows platform with GBK encoding
sherman
parents:
diff
changeset
|
40 |
return new GBK_OLD.Decoder(this); |
5c9886498f31
6299219: euro sign failed to be printed in Console on Localized Windows platform with GBK encoding
sherman
parents:
diff
changeset
|
41 |
} |
5c9886498f31
6299219: euro sign failed to be printed in Console on Localized Windows platform with GBK encoding
sherman
parents:
diff
changeset
|
42 |
|
5c9886498f31
6299219: euro sign failed to be printed in Console on Localized Windows platform with GBK encoding
sherman
parents:
diff
changeset
|
43 |
public boolean contains(Charset cs) { |
5c9886498f31
6299219: euro sign failed to be printed in Console on Localized Windows platform with GBK encoding
sherman
parents:
diff
changeset
|
44 |
return cs instanceof X11GBK_OLD; |
5c9886498f31
6299219: euro sign failed to be printed in Console on Localized Windows platform with GBK encoding
sherman
parents:
diff
changeset
|
45 |
} |
5c9886498f31
6299219: euro sign failed to be printed in Console on Localized Windows platform with GBK encoding
sherman
parents:
diff
changeset
|
46 |
|
5c9886498f31
6299219: euro sign failed to be printed in Console on Localized Windows platform with GBK encoding
sherman
parents:
diff
changeset
|
47 |
private class Encoder extends GBK_OLD.Encoder { |
5c9886498f31
6299219: euro sign failed to be printed in Console on Localized Windows platform with GBK encoding
sherman
parents:
diff
changeset
|
48 |
public Encoder(Charset cs) { |
5c9886498f31
6299219: euro sign failed to be printed in Console on Localized Windows platform with GBK encoding
sherman
parents:
diff
changeset
|
49 |
super(cs); |
5c9886498f31
6299219: euro sign failed to be printed in Console on Localized Windows platform with GBK encoding
sherman
parents:
diff
changeset
|
50 |
} |
5c9886498f31
6299219: euro sign failed to be printed in Console on Localized Windows platform with GBK encoding
sherman
parents:
diff
changeset
|
51 |
public boolean canEncode(char ch){ |
5c9886498f31
6299219: euro sign failed to be printed in Console on Localized Windows platform with GBK encoding
sherman
parents:
diff
changeset
|
52 |
if (ch < 0x80) return false; |
5c9886498f31
6299219: euro sign failed to be printed in Console on Localized Windows platform with GBK encoding
sherman
parents:
diff
changeset
|
53 |
return super.canEncode(ch); |
5c9886498f31
6299219: euro sign failed to be printed in Console on Localized Windows platform with GBK encoding
sherman
parents:
diff
changeset
|
54 |
} |
5c9886498f31
6299219: euro sign failed to be printed in Console on Localized Windows platform with GBK encoding
sherman
parents:
diff
changeset
|
55 |
} |
5c9886498f31
6299219: euro sign failed to be printed in Console on Localized Windows platform with GBK encoding
sherman
parents:
diff
changeset
|
56 |
} |