< prev index next >

test/sun/security/util/asn1StringTypes/StringTypes.java

Print this page




   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 /*
  25  * @test
  26  * @bug 4178326
  27  * @summary Make sure reading/writing of different DER encoded string
  28  * types works correctly.

  29  */
  30 
  31 import java.io.*;
  32 import sun.security.util.*;
  33 
  34 public class StringTypes {
  35 
  36     private static String s = null;
  37     private static String fileName = "StringTypes.bin";
  38 
  39     public static void main(String[] args) throws Exception {
  40 
  41         s = new String("This is just a test!");
  42 
  43         byte[] asciiBytes = s.getBytes("ASCII");
  44         byte[] utf8Bytes = s.getBytes("UTF8");
  45         byte[] iso8859_1Bytes = s.getBytes("ISO-8859-1");
  46 
  47         byte[] unicodeBytes = s.getBytes("UnicodeBigUnmarked");
  48         byte[] unicodeBytes2 = getBytes(s);




   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 /*
  25  * @test
  26  * @bug 4178326
  27  * @summary Make sure reading/writing of different DER encoded string
  28  * types works correctly.
  29  * @modules java.base/sun.security.util
  30  */
  31 
  32 import java.io.*;
  33 import sun.security.util.*;
  34 
  35 public class StringTypes {
  36 
  37     private static String s = null;
  38     private static String fileName = "StringTypes.bin";
  39 
  40     public static void main(String[] args) throws Exception {
  41 
  42         s = new String("This is just a test!");
  43 
  44         byte[] asciiBytes = s.getBytes("ASCII");
  45         byte[] utf8Bytes = s.getBytes("UTF8");
  46         byte[] iso8859_1Bytes = s.getBytes("ISO-8859-1");
  47 
  48         byte[] unicodeBytes = s.getBytes("UnicodeBigUnmarked");
  49         byte[] unicodeBytes2 = getBytes(s);


< prev index next >