test/jdk/java/lang/String/CompactString/CompactString.java
changeset 51994 7577686cc9bd
parent 47216 71c04702a3d5
equal deleted inserted replaced
51993:c0d05cf1d19d 51994:7577686cc9bd
     1 /*
     1 /*
     2  * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2015, 2018, Oracle and/or its affiliates. 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.
     7  * published by the Free Software Foundation.
   273                     src.getCharArray(), src.getIntArray());
   273                     src.getCharArray(), src.getIntArray());
   274         }
   274         }
   275     }
   275     }
   276 
   276 
   277     /*
   277     /*
   278      * Because right now system default charset in JPRT environment is only
   278      * Escape non-ASCII characters since not all systems support them.
   279      * guaranteed to support ASCII characters in log, so we escape them.
       
   280      */
   279      */
   281     protected String escapeNonASCIIs(String str) {
   280     protected String escapeNonASCIIs(String str) {
   282         StringBuilder sb = new StringBuilder();
   281         StringBuilder sb = new StringBuilder();
   283         for (int i = 0; i < str.length(); i++) {
   282         for (int i = 0; i < str.length(); i++) {
   284             char c = str.charAt(i);
   283             char c = str.charAt(i);
   290         }
   289         }
   291         return sb.toString();
   290         return sb.toString();
   292     }
   291     }
   293 
   292 
   294     /*
   293     /*
   295      * Because right now system default charset in JPRT environment is only
   294      * Escape non-ASCII characters since not all systems support them.
   296      * guaranteed to support ASCII characters in log, so we escape them.
       
   297      */
   295      */
   298     protected String escapeNonASCII(char c) {
   296     protected String escapeNonASCII(char c) {
   299         StringBuilder sb = new StringBuilder();
   297         StringBuilder sb = new StringBuilder();
   300         if (c > 0x7F) {
   298         if (c > 0x7F) {
   301             sb.append("\\u").append(Integer.toHexString((int) c));
   299             sb.append("\\u").append(Integer.toHexString((int) c));