jdk/src/share/classes/sun/io/CharToByteJIS0201.java
changeset 1713 f8b8bfa64fc1
parent 2 90ce3da70b43
child 5506 202f599c92aa
--- a/jdk/src/share/classes/sun/io/CharToByteJIS0201.java	Wed Dec 10 11:59:32 2008 +0100
+++ b/jdk/src/share/classes/sun/io/CharToByteJIS0201.java	Wed Dec 10 14:03:15 2008 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright 1997-1998 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1996-2008 Sun Microsystems, Inc.  All Rights Reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -29,6 +29,7 @@
  * Tables and data to convert Unicode to JIS0201
  *
  * @author  ConverterGenerator tool
+ * @version >= JDK1.1.6
  */
 
 class CharToByteJIS0201 extends CharToByteSingleByte {
@@ -41,8 +42,21 @@
         super.mask1 = 0xFF00;
         super.mask2 = 0x00FF;
         super.shift = 8;
+        /*
         super.index1 = index1;
         super.index2 = index2;
+        */
+    }
+
+    public byte getNative(char inputChar) {
+        return (byte)index2.charAt(index1[(inputChar & mask1) >> shift]
+                + (inputChar & mask2));
+    }
+
+   public boolean canConvert(char ch) {
+        if (index2.charAt(index1[((ch & mask1) >> shift)] + (ch & mask2)) != '\u0000')
+            return true;
+        return (ch == '\u0000');
     }
 
     private final static String index2 =