< prev index next >

src/java.base/share/classes/java/lang/String.java

Print this page

        

*** 111,121 **** * @see java.nio.charset.Charset * @since 1.0 */ public final class String ! implements java.io.Serializable, Comparable<String>, CharSequence { /** The value is used for character storage. */ private final char value[]; /** Cache the hash code for the string */ private int hash; // Default to 0 --- 111,122 ---- * @see java.nio.charset.Charset * @since 1.0 */ public final class String ! implements java.io.Serializable, Comparable<String>, CharSequence, ! sun.misc.ConstantLengthCharSequence { /** The value is used for character storage. */ private final char value[]; /** Cache the hash code for the string */ private int hash; // Default to 0
*** 787,796 **** --- 788,805 ---- void getChars(char dst[], int dstBegin) { System.arraycopy(value, 0, dst, dstBegin, value.length); } /** + * Returns a character array representing characters of this String. + * It may be shared with the String, so it should not be modified. + */ + char[] getCharsShared() { + return value; + } + + /** * Copies characters from this string into the destination character * array. * <p> * The first character to be copied is at index {@code srcBegin}; * the last character to be copied is at index {@code srcEnd-1}
< prev index next >