harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From arc...@apache.org
Subject svn commit: r411596 [2/4] - in /incubator/harmony/enhanced/classlibadapter/trunk: ./ modules/kernel/src/main/java/gnu/classpath/ modules/kernel/src/main/java/java/lang/ modules/kernel/src/main/java/java/lang/ref/ modules/kernel/src/main/java/java/lang/...
Date Sun, 04 Jun 2006 20:55:04 GMT
Modified: incubator/harmony/enhanced/classlibadapter/trunk/modules/kernel/src/main/java/java/lang/String.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlibadapter/trunk/modules/kernel/src/main/java/java/lang/String.java?rev=411596&r1=411595&r2=411596&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlibadapter/trunk/modules/kernel/src/main/java/java/lang/String.java (original)
+++ incubator/harmony/enhanced/classlibadapter/trunk/modules/kernel/src/main/java/java/lang/String.java Sun Jun  4 13:55:02 2006
@@ -1,37 +1,166 @@
-/* Copyright 1998, 2005 The Apache Software Foundation or its licensors, as applicable
- * 
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
+/*
+ *  Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
  *     http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+/*
+ *  Portions, Copyright c 1991-2005 Unicode, Inc.
+ *  The following applies to Unicode:
+ *
+ *  Copyright c 1991-2005 Unicode, Inc. All rights reserved. Distributed under the Terms of Use in
+ *
+ *  http://www.unicode.org/copyright.html
+ *
+ *  Permission is hereby granted, free of charge, to any person obtaining
+ *  a copy of the Unicode data files and any associated documentation (the "Data Files")
+ *  or Unicode software and any associated documentation (the "Software") to deal in the Data Files
+ *  or Software without restriction, including without limitation the rights
+ *  to use, copy, modify, merge, publish, distribute, and/or sell copies of the Data Files or Software,
+ *  and to permit persons to whom the Data Files or Software are furnished to do so, provided that
+ *  (a) the above copyright notice(s) and this permission notice appear with all copies of the Data Files or Software,
+ *  (b) both the above copyright notice(s) and this permission notice appear in associated documentation, and
+ *  (c) there is clear notice in each modified Data File or in the Software as well as in the documentation
+ *  associated with the Data File(s) or Software that the data or software has been modified.
+ *
+ *  THE DATA FILES AND SOFTWARE ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
+ *  INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *  NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED
+ *  IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR
+ *  ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ *  NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THE DATA FILES OR SOFTWARE.
+ *
+ *  Except as contained in this notice, the name of a copyright holder shall not be used in advertising
+ *  or otherwise to promote the sale, use or other dealings in these Data Files or Software without prior
+ *  written authorization of the copyright holder.
+ *
+ *  2. Additional terms from the Database:
+ *  Copyright c 1995-1999 Unicode, Inc. All Rights reserved.
+ *  Disclaimer
+ *  The Unicode Character Database is provided as is by Unicode, Inc.
+ *  No claims are made as to fitness for any particular purpose.
+ *  No warranties of any kind are expressed or implied. The recipient agrees
+ *  to determine applicability of information provided. If this file has been purchased
+ *  on magnetic or optical media from Unicode, Inc., the sole remedy for any claim will be exchange
+ *  of defective media within 90 days of receipt.
+ *  This disclaimer is applicable for all other data files accompanying the Unicode Character Database,
+ *  some of which have been compiled by the Unicode Consortium, and some of which have been supplied by other sources.
+ *  Limitations on Rights to Redistribute This Data
+ *  Recipient is granted the right to make copies in any form for internal distribution and
+ *  to freely use the information supplied in the creation of products supporting the UnicodeTM Standard.
+ *  The files in the Unicode Character Database can be redistributed to third parties or other organizations
+ *  (whether for profit or not) as long as this notice and the disclaimer notice are retained.
+ *  Information can be extracted from these files and used in documentation or programs,
+ *  as long as there is an accompanying notice indicating the source.
+ *
+*/
+
+/**
+ * @author Dmitry B. Yershov
+ * @version $Revision: 1.1.2.2.4.6 $
  */
 
 package java.lang;
 
 import java.io.Serializable;
 import java.io.UnsupportedEncodingException;
+import java.nio.ByteBuffer;
+import java.nio.CharBuffer;
+import java.nio.charset.Charset;
 import java.util.Comparator;
 import java.util.Locale;
 import java.util.regex.Pattern;
-import java.util.regex.PatternSyntaxException;
+import java.util.WeakHashMap;
+import java.lang.ref.WeakReference;
 
 /**
- * The implementation of this class is provided, but the documented native must
- * be provided by the vm vendor.
- * 
- * Strings are objects which represent immutable arrays of characters.
- * 
- * @see StringBuffer
+ * @com.intel.drl.spec_ref 
  */
 public final class String implements Serializable, Comparable, CharSequence {
-	private static final long serialVersionUID = -6849794470754667710L;
+
+    /**
+     * @com.intel.drl.spec_ref 
+     */
+    public static final Comparator CASE_INSENSITIVE_ORDER = new CaseInsensitiveComparator();
+
+    /*
+     * The array was generated basing on the Unicode Standard, version 3.0.
+     * See the following links:
+     * http://www.unicode.org
+     * http://www.unicode.org/Public/3.0-Update/SpecialCasing-2.txt
+     */
+    private static final char[] charUpperSpecial = { '\u0048',
+        '\u0331', '\u0054', '\u0308', '\u0057', '\u030a', '\u0059', '\u030a',
+        '\u0041', '\u02be', '\u0000', '\u0000', '\u03a5', '\u0313', '\u0000',
+        '\u03a5', '\u0313', '\u0300', '\u03a5', '\u0313', '\u0301', '\u03a5',
+        '\u0313', '\u0342', '\u1f08', '\u0399', '\u0000', '\u1f09', '\u0399',
+        '\u0000', '\u1f0a', '\u0399', '\u0000', '\u1f0b', '\u0399', '\u0000',
+        '\u1f0c', '\u0399', '\u0000', '\u1f0d', '\u0399', '\u0000', '\u1f0e',
+        '\u0399', '\u0000', '\u1f0f', '\u0399', '\u0000', '\u1f08', '\u0399',
+        '\u0000', '\u1f09', '\u0399', '\u0000', '\u1f0a', '\u0399', '\u0000',
+        '\u1f0b', '\u0399', '\u0000', '\u1f0c', '\u0399', '\u0000', '\u1f0d',
+        '\u0399', '\u0000', '\u1f0e', '\u0399', '\u0000', '\u1f0f', '\u0399',
+        '\u0000', '\u1f28', '\u0399', '\u0000', '\u1f29', '\u0399', '\u0000',
+        '\u1f2a', '\u0399', '\u0000', '\u1f2b', '\u0399', '\u0000', '\u1f2c',
+        '\u0399', '\u0000', '\u1f2d', '\u0399', '\u0000', '\u1f2e', '\u0399',
+        '\u0000', '\u1f2f', '\u0399', '\u0000', '\u1f28', '\u0399', '\u0000',
+        '\u1f29', '\u0399', '\u0000', '\u1f2a', '\u0399', '\u0000', '\u1f2b',
+        '\u0399', '\u0000', '\u1f2c', '\u0399', '\u0000', '\u1f2d', '\u0399',
+        '\u0000', '\u1f2e', '\u0399', '\u0000', '\u1f2f', '\u0399', '\u0000',
+        '\u1f68', '\u0399', '\u0000', '\u1f69', '\u0399', '\u0000', '\u1f6a',
+        '\u0399', '\u0000', '\u1f6b', '\u0399', '\u0000', '\u1f6c', '\u0399',
+        '\u0000', '\u1f6d', '\u0399', '\u0000', '\u1f6e', '\u0399', '\u0000',
+        '\u1f6f', '\u0399', '\u0000', '\u1f68', '\u0399', '\u0000', '\u1f69',
+        '\u0399', '\u0000', '\u1f6a', '\u0399', '\u0000', '\u1f6b', '\u0399',
+        '\u0000', '\u1f6c', '\u0399', '\u0000', '\u1f6d', '\u0399', '\u0000',
+        '\u1f6e', '\u0399', '\u0000', '\u1f6f', '\u0399', '\u0000', '\u1fba',
+        '\u0399', '\u0000', '\u0391', '\u0399', '\u0000', '\u0386', '\u0399',
+        '\u0000', '\u0391', '\u0342', '\u0000', '\u0391', '\u0342', '\u0399',
+        '\u0391', '\u0399', '\u0000', '\u1fca', '\u0399', '\u0000', '\u0397',
+        '\u0399', '\u0000', '\u0389', '\u0399', '\u0000', '\u0397', '\u0342',
+        '\u0000', '\u0397', '\u0342', '\u0399', '\u0397', '\u0399', '\u0000',
+        '\u0399', '\u0308', '\u0300', '\u0399', '\u0308', '\u0301', '\u0399',
+        '\u0342', '\u0000', '\u0399', '\u0308', '\u0342', '\u03a5', '\u0308',
+        '\u0300', '\u03a5', '\u0308', '\u0301', '\u03a1', '\u0313', '\u0000',
+        '\u03a5', '\u0342', '\u0000', '\u03a5', '\u0308', '\u0342', '\u1ffa',
+        '\u0399', '\u0000', '\u03a9', '\u0399', '\u0000', '\u038f', '\u0399',
+        '\u0000', '\u03a9', '\u0342', '\u0000', '\u03a9', '\u0342', '\u0399',
+        '\u03a9', '\u0399', '\u0000', '\u0046', '\u0046', '\u0000', '\u0046',
+        '\u0049', '\u0000', '\u0046', '\u004c', '\u0000', '\u0046', '\u0046',
+        '\u0049', '\u0046', '\u0046', '\u004c', '\u0053', '\u0054', '\u0000',
+        '\u0053', '\u0054', '\u0000', '\u0544', '\u0546', '\u0000', '\u0544',
+        '\u0535', '\u0000', '\u0544', '\u053b', '\u0000', '\u054e', '\u0546',
+        '\u0000', '\u0544', '\u053d', '\u0000'           };
+
+    private static Charset defaultCharset = null;
+
+    private static final byte[] indexUp = { 4, 0, 5, 0, 6, 0,
+        7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 9, 10, 11, 12,
+        13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
+        31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48,
+        49, 50, 51, 52, 53, 54, 55, 0, 0, 56, 57, 58, 0, 59, 60, 0, 0, 0, 0,
+        61, 0, 0, 0, 0, 0, 62, 63, 64, 0, 65, 66, 0, 0, 0, 0, 67, 0, 0, 0, 0,
+        0, 68, 69, 0, 0, 70, 71, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 72, 73, 74, 0,
+        75, 76, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 77, 78, 79, 0, 80, 81, 0, 0, 0,
+        0, 82                                            };
+
+    private static final byte[] indexUp1 = { 83, 84, 85, 86,
+        87, 88, 89, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 90, 91, 92, 93, 94 };
+
+    private static final long serialVersionUID = -6849794470754667710L;
+
+
 
 	/**
 	 * An PrintStream used for System.out which performs the 
@@ -80,7 +209,6 @@
                 print("ERROR:   java.lang.String.print(String) has bad parameters");  //fixit
                 return;
             }
-            long bogusFileDescriptor = 0;  //fixit
             byte [] ba = new byte[str.value.length];
             for (int ii = 0; ii < str.value.length; ii++) 
             {
@@ -90,1716 +218,1133 @@
 		}
 	}
 
-	/**
-	 * CaseInsensitiveComparator compares Strings ignoring the case of the
-	 * characters.
-	 */
-	private static final class CaseInsensitiveComparator implements Comparator,
-			Serializable {
-		private static final long serialVersionUID = 8575799808933029326L;
-
-		/**
-		 * Compare the two objects to determine
-		 * the relative ordering. 
-		 *
-		 * @param		o1	an Object to compare
-		 * @param		o2	an Object to compare
-		 * @return		an int < 0 if object1 is less than object2,
-		 *				0 if they are equal, and > 0 if object1 is greater
-		 *
-		 * @exception	ClassCastException when objects are not the correct type
-		 */
-		public int compare(Object o1, Object o2) {
-			return ((String) o1).compareToIgnoreCase((String) o2);
-		}
-	}
-
-	/*
-	 * A Comparator which compares Strings ignoring the case of the characters.
-	 */
-	public static final Comparator CASE_INSENSITIVE_ORDER = new CaseInsensitiveComparator();
+    final char[] value;
+    final int offset;
+    final int count;
 
-	private static final char[] ascii;
+    private int hashCode;
 
-	private final char[] value;
+    char[] getValue() {
+        return value;
+    }
 
-	private final int offset;
+    /**
+     * Returns the smaller of two int values.
+     * Is implemented to avoid loading the Math class on startup
+     * @param first the first int value
+     * @param second the second int value
+     * @return the smaller of the two values
+     */
+    private static int min(int first, int second) {
+        return (first >= second ? second : first);
+    }
+    
+    /**
+     * @com.intel.drl.spec_ref 
+     */
+    public String() {
+        this("");
+    }
 
-	private final int count;
+    /**
+     * @com.intel.drl.spec_ref 
+     */
+    public String(byte[] bytes) {
+        Charset cs = getDefaultCharset();
+        ByteBuffer bb = ByteBuffer.allocate(bytes.length);
+        bb.put(bytes, 0, bytes.length);
+        bb.position(0);
+        CharBuffer cb = cs.decode(bb);
+        value = new char[cb.length()];
+        cb.get(value);
+        this.offset = 0;
+        this.count = this.value.length;
+    }
 
-	private int hashCode;
+    /**
+     * @com.intel.drl.spec_ref 
+     */
+    public String(byte[] ascii, int hibyte) {
+        int count = ascii.length;
+        value = new char[count];
+        this.offset = 0;
+        this.count = count;
+        hibyte = (hibyte & 0xff) << 8;
+        for (int i = 0; i < count; i++) {
+            value[i] = (char)(hibyte | (ascii[i] & 0xff));
+        }
+    }
 
-	static {
-		ascii = new char[128];
-		for (int i = 0; i < ascii.length; i++)
-			ascii[i] = (char) i;
-	}
+    /**
+     * @com.intel.drl.spec_ref 
+     */
+    public String(byte[] bytes, int offset, int length) {
+        if (offset < 0) {
+            throw new StringIndexOutOfBoundsException(offset);
+        }
+        if (length < 0) {
+            throw new StringIndexOutOfBoundsException(length);
+        }
+        if (bytes.length - offset < length) {
+            throw new StringIndexOutOfBoundsException(offset + length);
+        }
+        Charset cs = getDefaultCharset();
+        ByteBuffer bb = ByteBuffer.allocate(length);
+        bb.put(bytes, offset, length);
+        bb.position(0);
+        CharBuffer cb = cs.decode(bb);
+        this.value = new char[cb.length()];
+        cb.get(value);
+        this.offset = 0;
+        this.count = this.value.length;
+    }
 
-	/**
-	 * Answers an empty string.
-	 */
-	public String() {
-		value = new char[0];
-		offset = 0;
-		count = 0;
-	}
+    /**
+     * @com.intel.drl.spec_ref 
+     */
+    public String(byte[] ascii, int hibyte, int offset, int count) {
+        if (offset < 0) {
+            throw new StringIndexOutOfBoundsException(offset);
+        }
+        if (count < 0) {
+            throw new StringIndexOutOfBoundsException(count);
+        }
+        if (ascii.length - offset < count) {
+            throw new StringIndexOutOfBoundsException(offset + count);
+        }
+        value = new char[count];
+        this.offset = 0;
+        this.count = count;
+        hibyte = (hibyte & 0xff) << 8;
+        for (int i = 0; i < count; i++, offset++) {
+            value[i] = (char)(hibyte | (ascii[offset] & 0xff));
+        }
+    }
 
-	private String(String s, char c) {
-		offset = 0;
-		value = new char[s.count + 1];
-		count = s.count + 1;
-		System.arraycopy(s.value, s.offset, value, 0, s.count);
-		value[s.count] = c;
-	}
+    /**
+     * @com.intel.drl.spec_ref 
+     */
+    public String(byte[] bytes, int offset, int length, String charsetName)
+        throws UnsupportedEncodingException {
+        if (offset < 0) {
+            throw new StringIndexOutOfBoundsException(offset);
+        }
+        if (length < 0) {
+            throw new StringIndexOutOfBoundsException(length);
+        }
+        if (bytes.length - offset < length) {
+            throw new StringIndexOutOfBoundsException(offset + length);
+        }
+        if (charsetName == null) {
+            throw new NullPointerException("charsetName");
+        }
+        Charset cs;
+        try {
+            cs = Charset.forName(charsetName);
+        } catch (Exception ex) {
+            UnsupportedEncodingException throwEx = new UnsupportedEncodingException();
+            throwEx.initCause(ex);
+            throw throwEx;
+        }
+        ByteBuffer bb = ByteBuffer.allocate(length);
+        bb.put(bytes, offset, length);
+        bb.position(0);
+        CharBuffer cb = cs.decode(bb);
+        this.value = new char[cb.length()];
+        cb.get(value);
+        this.offset = 0;
+        this.count = this.value.length;
+    }
 
-	/**
-	 * Converts the byte array to a String using the default encoding as
-	 * specified by the file.encoding system property. If the system property is
-	 * not defined, the default encoding is ISO8859_1 (ISO-Latin-1). If 8859-1
-	 * is not available, an ASCII encoding is used.
-	 * 
-	 * @param data
-	 *            the byte array to convert to a String
-	 * 
-	 * @throws NullPointerException
-	 *             when data is null
-	 * 
-	 * @see #getBytes()
-	 * @see #getBytes(int, int, byte[], int)
-	 * @see #getBytes(String)
-	 * @see #valueOf(boolean)
-	 * @see #valueOf(char)
-	 * @see #valueOf(char[])
-	 * @see #valueOf(char[], int, int)
-	 * @see #valueOf(double)
-	 * @see #valueOf(float)
-	 * @see #valueOf(int)
-	 * @see #valueOf(long)
-	 * @see #valueOf(Object)
-	 * 
-	 */
-	public String(byte[] data) {
-		this(data, 0, data.length);
-	}
+    /**
+     * @com.intel.drl.spec_ref 
+     */
+    public String(byte[] bytes, String charsetName)
+        throws UnsupportedEncodingException {
+        int length = bytes.length;
+        Charset cs;
+        try {
+            cs = Charset.forName(charsetName);
+        } catch (Exception ex) {
+            UnsupportedEncodingException throwEx = new UnsupportedEncodingException();
+            throwEx.initCause(ex);
+            throw throwEx;
+        }
+        ByteBuffer bb = ByteBuffer.allocate(length);
+        bb.put(bytes, 0, length);
+        bb.position(0);
+        CharBuffer cb = cs.decode(bb);
+        this.value = new char[cb.length()];
+        cb.get(value);
+        this.offset = 0;
+        this.count = this.value.length;
+    }
 
-	/**
-	 * Converts the byte array to a String, setting the high byte of every
-	 * character to the specified value.
-	 * 
-	 * @param data
-	 *            the byte array to convert to a String
-	 * @param high
-	 *            the high byte to use
-	 * 
-	 * @throws NullPointerException
-	 *             when data is null
-	 * 
-	 * @deprecated Use String(byte[]) or String(byte[], String) instead
-	 */
-	public String(byte[] data, int high) {
-		this(data, high, 0, data.length);
-	}
+    /**
+     * @com.intel.drl.spec_ref 
+     */
+    public String(char[] value) {
+        this.count = value.length;
+        this.value = new char[count];
+        this.offset = 0;
+        System.arraycopy(value, 0, this.value, 0, count);
+    }
 
-	/**
-	 * Converts the byte array to a String using the default encoding as
-	 * specified by the file.encoding system property. If the system property is
-	 * not defined, the default encoding is ISO8859_1 (ISO-Latin-1). If 8859-1
-	 * is not available, an ASCII encoding is used.
-	 * 
-	 * @param data
-	 *            the byte array to convert to a String
-	 * @param start
-	 *            the starting offset in the byte array
-	 * @param length
-	 *            the number of bytes to convert
-	 * 
-	 * @throws IndexOutOfBoundsException
-	 *             when <code>length < 0, start < 0</code> or
-	 *             <code>start + length > data.length</code>
-	 * @throws NullPointerException
-	 *             when data is null
-	 * 
-	 * @see #getBytes()
-	 * @see #getBytes(int, int, byte[], int)
-	 * @see #getBytes(String)
-	 * @see #valueOf(boolean)
-	 * @see #valueOf(char)
-	 * @see #valueOf(char[])
-	 * @see #valueOf(char[], int, int)
-	 * @see #valueOf(double)
-	 * @see #valueOf(float)
-	 * @see #valueOf(int)
-	 * @see #valueOf(long)
-	 * @see #valueOf(Object)
-	 * 
-	 */
-	public String(byte[] data, int start, int length) {
-		value = new char[0];
-		offset = 0;
-		count = 0;
-	}
+    /**
+     * @com.intel.drl.spec_ref 
+     */
+    public String(char[] value, int offset, int count) {
+        if (offset < 0) {
+            throw new StringIndexOutOfBoundsException(offset);
+        }
+        if (count < 0) {
+            throw new StringIndexOutOfBoundsException(count);
+        }
+        if (value.length - offset < count) {
+            throw new StringIndexOutOfBoundsException(offset + count);
+        }
+        this.value = new char[count];
+        this.offset = 0;
+        this.count = count;
+        System.arraycopy(value, offset, this.value, 0, count);
+    }
 
-	/**
-	 * Converts the byte array to a String, setting the high byte of every
-	 * character to the specified value.
-	 * 
-	 * @param data
-	 *            the byte array to convert to a String
-	 * @param high
-	 *            the high byte to use
-	 * @param start
-	 *            the starting offset in the byte array
-	 * @param length
-	 *            the number of bytes to convert
-	 * 
-	 * @throws IndexOutOfBoundsException
-	 *             when <code>length < 0, start < 0</code> or
-	 *             <code>start + length > data.length</code>
-	 * @throws NullPointerException
-	 *             when data is null
-	 * 
-	 * @deprecated Use String(byte[], int, int) instead
-	 */
-	public String(byte[] data, int high, int start, int length) {
-		if (data != null) {
-			// start + length could overflow, start/length maybe MaxInt
-			if (start >= 0 && 0 <= length && length <= data.length - start) {
-				offset = 0;
-				value = new char[length];
-				count = length;
-				high <<= 8;
-				for (int i = 0; i < count; i++)
-					value[i] = (char) (high + (data[start++] & 0xff));
-			} else
-				throw new StringIndexOutOfBoundsException();
-		} else
-			throw new NullPointerException();
-	}
+    /**
+     * @com.intel.drl.spec_ref 
+     */
+    public String(String original) {
+        value = original.value;
+        count = original.count;
+        offset = original.offset;
+        hashCode = original.hashCode;
+    }
 
-	/**
-	 * Converts the byte array to a String using the specified encoding.
-	 * 
-	 * @param data
-	 *            the byte array to convert to a String
-	 * @param start
-	 *            the starting offset in the byte array
-	 * @param length
-	 *            the number of bytes to convert
-	 * @param encoding
-	 *            the encoding
-	 * 
-	 * @throws IndexOutOfBoundsException
-	 *             when <code>length < 0, start < 0</code> or
-	 *             <code>start + length > data.length</code>
-	 * @throws UnsupportedEncodingException
-	 *             when encoding is not supported
-	 * @throws NullPointerException
-	 *             when data is null
-	 * 
-	 * @see #getBytes()
-	 * @see #getBytes(int, int, byte[], int)
-	 * @see #getBytes(String)
-	 * @see #valueOf(boolean)
-	 * @see #valueOf(char)
-	 * @see #valueOf(char[])
-	 * @see #valueOf(char[], int, int)
-	 * @see #valueOf(double)
-	 * @see #valueOf(float)
-	 * @see #valueOf(int)
-	 * @see #valueOf(long)
-	 * @see #valueOf(Object)
-	 * @see UnsupportedEncodingException
-	 */
-	public String(byte[] data, int start, int length, final String encoding)
-			throws UnsupportedEncodingException {
-		throw new UnsupportedEncodingException();
-	}
+    /**
+     * @com.intel.drl.spec_ref 
+     */
+    public String(StringBuffer buffer) {
+        synchronized (buffer) {
+            String str = buffer.toString();
+            offset = str.offset;
+            count = str.count;
+            value = str.value;
+        }
+    }
 
-	/**
-	 * Converts the byte array to a String using the specified encoding.
-	 * 
-	 * @param data
-	 *            the byte array to convert to a String
-	 * @param encoding
-	 *            the encoding
-	 * 
-	 * @throws UnsupportedEncodingException
-	 *             when encoding is not supported
-	 * @throws NullPointerException
-	 *             when data is null
-	 * 
-	 * @see #getBytes()
-	 * @see #getBytes(int, int, byte[], int)
-	 * @see #getBytes(String)
-	 * @see #valueOf(boolean)
-	 * @see #valueOf(char)
-	 * @see #valueOf(char[])
-	 * @see #valueOf(char[], int, int)
-	 * @see #valueOf(double)
-	 * @see #valueOf(float)
-	 * @see #valueOf(int)
-	 * @see #valueOf(long)
-	 * @see #valueOf(Object)
-	 * @see UnsupportedEncodingException
-	 */
-	public String(byte[] data, String encoding)
-			throws UnsupportedEncodingException {
-		this(data, 0, data.length, encoding);
-	}
+    /*
+     * Internal constructor. It doesn't create new object char[] for created
+     * String object.
+     */
+    String(int offset, int count, char[] value) {
+        this.value = value;
+        this.count = count;
+        this.offset = offset;
+    }
 
-	/**
-	 * Initializes this String to contain the characters in the specified
-	 * character array. Modifying the character array after creating the String
-	 * has no effect on the String.
-	 * 
-	 * @param data
-	 *            the array of characters
-	 * 
-	 * @throws NullPointerException
-	 *             when data is null
-	 */
-	public String(char[] data) {
-		this(data, 0, data.length);
-	}
+    /**
+     * @com.intel.drl.spec_ref 
+     */
+    public static String copyValueOf(char[] data) {
+        return new String(data);
+    }
 
-	/**
-	 * Initializes this String to contain the specified characters in the
-	 * character array. Modifying the character array after creating the String
-	 * has no effect on the String.
-	 * 
-	 * @param data
-	 *            the array of characters
-	 * @param start
-	 *            the starting offset in the character array
-	 * @param length
-	 *            the number of characters to use
-	 * 
-	 * @throws IndexOutOfBoundsException
-	 *             when <code>length < 0, start < 0</code> or
-	 *             <code>start + length > data.length</code>
-	 * @throws NullPointerException
-	 *             when data is null
-	 */
-	public String(char[] data, int start, int length) {
-		// range check everything so a new char[] is not created
-		// start + length could overflow, start/length maybe MaxInt
-		if (start >= 0 && 0 <= length && length <= data.length - start) {
-			offset = 0;
-			value = new char[length];
-			count = length;
-			try {
-				System.arraycopy(data, start, value, 0, count);
-			} catch (IndexOutOfBoundsException e) {
-				throw new StringIndexOutOfBoundsException();
-			}
-		} else
-			throw new StringIndexOutOfBoundsException();
-	}
+    /**
+     * @com.intel.drl.spec_ref 
+     */
+    public static String copyValueOf(char[] data, int offset, int count) {
+        return new String(data, offset, count);
+    }
 
-	/*
-	 * Internal version of string constructor. Does not range check, null check,
-	 * or copy the character array.
-	 */
-	String(int start, int length, char[] data) {
-		value = data;
-		offset = start;
-		count = length;
-	}
+    /**
+     * @com.intel.drl.spec_ref 
+     */
+    public static String valueOf(boolean b) {
+        return b ? "true" : "false";
+    }
 
-	/**
-	 * Creates a string that is a copy of another string
-	 * 
-	 * @param string
-	 *            the String to copy
-	 */
-	public String(String string) {
-		value = string.value;
-		offset = string.offset;
-		count = string.count;
-	}
+    /**
+     * @com.intel.drl.spec_ref 
+     */
+    public static String valueOf(char c) {
+        return new String(0, 1, new char[] { c });
+    }
 
-	/**
-	 * Creates a string from the contents of a StringBuffer.
-	 * 
-	 * @param stringbuffer
-	 *            the StringBuffer
-	 */
-	public String(StringBuffer stringbuffer) {
-		value = new char[0];
-		offset = 0;
-		count = 0;
-		synchronized (stringbuffer) {
-		}
-	}
+    /**
+     * @com.intel.drl.spec_ref 
+     */
+    public static String valueOf(char[] data) {
+        return new String(data);
+    }
 
-	/*
-	 * Creates a string that is s1 + v1.
-	 */
-	private String(String s1, int v1) {
-		if (s1 == null)
-			s1 = "null";
-		String s2 = String.valueOf(v1);
-		int len = s1.count + s2.count;
-		value = new char[len];
-		offset = 0;
-		System.arraycopy(s1.value, s1.offset, value, 0, s1.count);
-		System.arraycopy(s2.value, s2.offset, value, s1.count, s2.count);
-		count = len;
-	}
+    /**
+     * @com.intel.drl.spec_ref 
+     */
+    public static String valueOf(char[] data, int offset, int count) {
+        return new String(data, offset, count);
+    }
 
-	/**
-	 * Answers the character at the specified offset in this String.
-	 * 
-	 * @param index
-	 *            the zero-based index in this string
-	 * @return the character at the index
-	 * 
-	 * @throws IndexOutOfBoundsException
-	 *             when <code>index < 0</code> or
-	 *             <code>index >= length()</code>
-	 */
-	public char charAt(int index) {
-		if (0 <= index && index < count)
-			return value[offset + index];
-		throw new StringIndexOutOfBoundsException();
-	}
+    /**
+     * @com.intel.drl.spec_ref 
+     */
+    public static String valueOf(double d) {
+        return Double.toString(d);
+    }
 
-	/**
-	 * Compare the receiver to the specified Object to determine the relative
-	 * ordering.
-	 * 
-	 * @param object
-	 *            an Object
-	 * @return an int < 0 if this String is less than the specified String, 0 if
-	 *         they are equal, and > 0 if this String is greater
-	 * 
-	 * @throws ClassCastException
-	 *             when object is not a String
-	 */
-	public int compareTo(Object object) {
-		return compareTo((String) object);
-	}
+    /**
+     * @com.intel.drl.spec_ref 
+     */
+    public static String valueOf(float f) {
+        return Float.toString(f);
+    }
 
-	/**
-	 * Compares the specified String to this String using the Unicode values of
-	 * the characters. Answer 0 if the strings contain the same characters in
-	 * the same order. Answer a negative integer if the first non-equal
-	 * character in this String has a Unicode value which is less than the
-	 * Unicode value of the character at the same position in the specified
-	 * string, or if this String is a prefix of the specified string. Answer a
-	 * positive integer if the first non-equal character in this String has a
-	 * Unicode value which is greater than the Unicode value of the character at
-	 * the same position in the specified string, or if the specified String is
-	 * a prefix of the this String.
-	 * 
-	 * @param string
-	 *            the string to compare
-	 * @return 0 if the strings are equal, a negative integer if this String is
-	 *         before the specified String, or a positive integer if this String
-	 *         is after the specified String
-	 * 
-	 * @throws NullPointerException
-	 *             when string is null
-	 */
-	public int compareTo(String string) {
-		// Code adapted from K&R, pg 101
-		int o1 = offset, o2 = string.offset, result;
-		int end = offset + (count < string.count ? count : string.count);
-		char[] target = string.value;
-		while (o1 < end)
-			if ((result = value[o1++] - target[o2++]) != 0)
-				return result;
-		return count - string.count;
-	}
+    /**
+     * @com.intel.drl.spec_ref 
+     */
+    public static String valueOf(int i) {
+        return Integer.toString(i);
+    }
 
-	/**
-	 * Compare the receiver to the specified String to determine the relative
-	 * ordering when the case of the characters is ignored.
-	 * 
-	 * @param string
-	 *            a String
-	 * @return an int < 0 if this String is less than the specified String, 0 if
-	 *         they are equal, and > 0 if this String is greater
-	 */
-	public int compareToIgnoreCase(String string) {
-		int o1 = offset, o2 = string.offset, result;
-		int end = offset + (count < string.count ? count : string.count);
-		char c1, c2;
-		char[] target = string.value;
-		while (o1 < end) {
-			if ((c1 = value[o1++]) == (c2 = target[o2++]))
-				continue;
-			c1 = Character.toLowerCase(Character.toUpperCase(c1));
-			c2 = Character.toLowerCase(Character.toUpperCase(c2));
-			if ((result = c1 - c2) != 0)
-				return result;
-		}
-		return count - string.count;
-	}
+    /**
+     * @com.intel.drl.spec_ref 
+     */
+    public static String valueOf(long l) {
+        return Long.toString(l);
+    }
 
-	/**
-	 * Concatenates this String and the specified string.
-	 * 
-	 * @param string
-	 *            the string to concatenate
-	 * @return a new String which is the concatenation of this String and the
-	 *         specified String
-	 * 
-	 * @throws NullPointerException
-	 *             if string is null
-	 */
-	public String concat(String string) {
-		if (string.count > 0 && count > 0) {
-			char[] buffer = new char[count + string.count];
-			System.arraycopy(value, offset, buffer, 0, count);
-			System.arraycopy(string.value, string.offset, buffer, count,
-					string.count);
-			return new String(0, buffer.length, buffer);
-		}
-		return count == 0 ? string : this;
-	}
+    /**
+     * @com.intel.drl.spec_ref 
+     */
+    public static String valueOf(Object obj) {
+        return obj == null ? "null" : obj.toString();
+    }
 
-	/**
-	 * Creates a new String containing the characters in the specified character
-	 * array. Modifying the character array after creating the String has no
-	 * effect on the String.
-	 * 
-	 * @param data
-	 *            the array of characters
-	 * @return the new String
-	 * 
-	 * @throws NullPointerException
-	 *             if data is null
-	 */
-	public static String copyValueOf(char[] data) {
-		return new String(data, 0, data.length);
-	}
+    /**
+     * @com.intel.drl.spec_ref 
+     */
+    public char charAt(int index) {
+        if (index >= 0 && index < count) {
+            return value[offset + index];
+        }
+        throw new StringIndexOutOfBoundsException(index);
+    }
+    
+    /**
+     * @com.intel.drl.spec_ref 
+     */
+    public int compareTo(Object o) {
+        return compareTo((String)o);
+    }
 
-	/**
-	 * Creates a new String containing the specified characters in the character
-	 * array. Modifying the character array after creating the String has no
-	 * effect on the String.
-	 * 
-	 * @param data
-	 *            the array of characters
-	 * @param start
-	 *            the starting offset in the character array
-	 * @param length
-	 *            the number of characters to use
-	 * @return the new String
-	 * 
-	 * @throws IndexOutOfBoundsException
-	 *             if <code>length < 0, start < 0</code> or
-	 *             <code>start + length > data.length</code>
-	 * @throws NullPointerException
-	 *             if data is null
-	 */
-	public static String copyValueOf(char[] data, int start, int length) {
-		return new String(data, start, length);
-	}
+    /**
+     * @com.intel.drl.spec_ref 
+     */
+    public int compareTo(String anotherString) {
+        int diff;
+        int j = anotherString.offset;
+        int minLength = min(count, anotherString.count) + offset;
+        for (int i = offset; i < minLength; i++, j++) {
+            diff = this.value[i] - anotherString.value[j];
+            if (diff != 0) {
+                return diff;
+            }
+        }
+        return this.count - anotherString.count;
+    }
 
-	/**
-	 * Compares the specified string to this String to determine if the
-	 * specified string is a suffix.
-	 * 
-	 * @param suffix
-	 *            the string to look for
-	 * @return true when the specified string is a suffix of this String, false
-	 *         otherwise
-	 * 
-	 * @throws NullPointerException
-	 *             if suffix is null
-	 */
-	public boolean endsWith(String suffix) {
-		return regionMatches(count - suffix.count, suffix, 0, suffix.count);
-	}
+    /**
+     * @com.intel.drl.spec_ref 
+     */
+    public int compareToIgnoreCase(String str) {
+        int diff;
+        int j = str.offset;
+        int minLength = min(count, str.count) + offset;
+        for (int i = offset; i < minLength; i++, j++) {
+            if (value[i] != str.value[j]) {
+                diff = Character.toLowerCase(Character.toUpperCase(value[i]))
+                    - Character
+                        .toLowerCase(Character.toUpperCase(str.value[j]));
+                if (diff != 0) {
+                    return diff;
+                }
+            }
+        }
+        return this.count - str.count;
+    }
 
-	/**
-	 * Compares the specified object to this String and answer if they are
-	 * equal. The object must be an instance of String with the same characters
-	 * in the same order.
-	 * 
-	 * @param object
-	 *            the object to compare
-	 * @return true if the specified object is equal to this String, false
-	 *         otherwise
-	 * 
-	 * @see #hashCode
-	 */
-	public boolean equals(Object object) {
-		if (object == this)
-			return true;
-		if (object instanceof String) {
-			String s = (String) object;
-			if (count != s.count
-					|| (hashCode != s.hashCode && hashCode != 0 && s.hashCode != 0))
-				return false;
-			return regionMatches(0, s, 0, count);
-		}
-		return false;
-	}
+    /**
+     * @com.intel.drl.spec_ref 
+     */
+    public String concat(String str) {
+        if (str.count == 0) {
+            return this;
+        }
+        if (count == 0) {
+            return str;
+        }
+        char[] charArray = new char[count + str.count];
+        System.arraycopy(value, offset, charArray, 0, count);
+        System.arraycopy(str.value, str.offset, charArray, count, str.count);
+        return new String(0, charArray.length, charArray);
+    }
 
-	/**
-	 * Compares the specified String to this String ignoring the case of the
-	 * characters and answer if they are equal.
-	 * 
-	 * @param string
-	 *            the string to compare
-	 * @return true if the specified string is equal to this String, false
-	 *         otherwise
-	 */
-	public boolean equalsIgnoreCase(String string) {
-		if (string == this)
-			return true;
-		if (string == null || count != string.count)
-			return false;
-
-		int o1 = offset, o2 = string.offset;
-		int end = offset + count;
-		char c1, c2;
-		char[] target = string.value;
-		while (o1 < end) {
-			if ((c1 = value[o1++]) != (c2 = target[o2++])
-					&& Character.toUpperCase(c1) != Character.toUpperCase(c2)
-					// Required for unicode that we test both cases
-					&& Character.toLowerCase(c1) != Character.toLowerCase(c2))
+    /**
+     * @com.intel.drl.spec_ref 
+     */
+    public boolean contentEquals(StringBuffer strbuf) {
+		synchronized (strbuf) {
+			int size = strbuf.length();
+			if (count != size)
 				return false;
+			return regionMatches(0, new String(0, size, strbuf.getValue()), 0,
+					size);
 		}
-		return true;
-	}
+    }
 
-	/**
-	 * Converts this String to a byte encoding using the default encoding as
-	 * specified by the file.encoding sytem property. If the system property is
-	 * not defined, the default encoding is ISO8859_1 (ISO-Latin-1). If 8859-1
-	 * is not available, an ASCII encoding is used.
-	 * 
-	 * @return the byte array encoding of this String
-	 * 
-	 * @see String
-	 */
-	public byte[] getBytes() {
-		//wjw   ----- return null;
-        //private final char[] value;
-        //private final int offset;
-        //private final int count;
-
-        byte [] ba = new byte[this.count];
-        for (int ii = 0; ii < count; ii++) 
-        {
-            ba[ii] = (byte) value[ii + offset];
+    /**
+     * @com.intel.drl.spec_ref 
+     */
+    public boolean endsWith(String suffix) {
+        int len = suffix.offset + suffix.count;
+        int j = offset + count - suffix.count;
+        if (j < offset) {
+            return false;
         }
-        return ba;
-	}
-
-	/**
-	 * Converts this String to a byte array, ignoring the high order bits of
-	 * each character.
-	 * 
-	 * @param start
-	 *            the starting offset of characters to copy
-	 * @param end
-	 *            the ending offset of characters to copy
-	 * @param data
-	 *            the destination byte array
-	 * @param index
-	 *            the starting offset in the byte array
-	 * 
-	 * @throws NullPointerException
-	 *             when data is null
-	 * @throws IndexOutOfBoundsException
-	 *             when
-	 *             <code>start < 0, end > length(), index < 0, end - start > data.length - index</code>
-	 * 
-	 * @deprecated Use getBytes() or getBytes(String)
-	 */
-	public void getBytes(int start, int end, byte[] data, int index) {
-		if (data != null) {
-			// index < 0, and end - start > data.length - index are caught by
-			// the catch below
-			// end > count not caught below when start == end
-			if (0 <= start && start <= end && end <= count) {
-				end += offset;
-				try {
-					for (int i = offset + start; i < end; i++)
-						data[index++] = (byte) value[i];
-				} catch (ArrayIndexOutOfBoundsException e) {
-					throw new StringIndexOutOfBoundsException();
-				}
-			} else
-				throw new StringIndexOutOfBoundsException();
-		} else
-			throw new NullPointerException();
-	}
-
-	/**
-	 * Converts this String to a byte encoding using the specified encoding.
-	 * 
-	 * @param encoding
-	 *            the encoding
-	 * @return the byte array encoding of this String
-	 * 
-	 * @throws UnsupportedEncodingException
-	 *             when the encoding is not supported
-	 * 
-	 * @see String
-	 * @see UnsupportedEncodingException
-	 */
-	public byte[] getBytes(String encoding) throws UnsupportedEncodingException {
-		//return null;
-        //wjw   ----- return null;
-        //private final char[] value;
-        //private final int offset;
-        //private final int count;
-
-        byte [] ba = new byte[this.count];
-        for (int ii = 0; ii < count; ii++) 
-        {
-            ba[ii] = (byte) value[ii + offset];
+        for (int i = suffix.offset; i < len; i++, j++) {
+            if (value[j] != suffix.value[i]) {
+                return false;
+            }
         }
-        return ba;  //wjw
-	}
-
-	/**
-	 * Copies the specified characters in this String to the character array
-	 * starting at the specified offset in the character array.
-	 * 
-	 * @param start
-	 *            the starting offset of characters to copy
-	 * @param end
-	 *            the ending offset of characters to copy
-	 * @param buffer
-	 *            the destination character array
-	 * @param index
-	 *            the starting offset in the character array
-	 * 
-	 * @throws IndexOutOfBoundsException
-	 *             when <code>start < 0, end > length(),
-	 *				start > end, index < 0, end - start > buffer.length - index</code>
-	 * @throws NullPointerException
-	 *             when buffer is null
-	 */
-	public void getChars(int start, int end, char[] buffer, int index) {
-		// NOTE last character not copied!
-		// Fast range check.
-		if (0 <= start && start <= end && end <= count)
-			System.arraycopy(value, start + offset, buffer, index, end - start);
-		else
-			throw new StringIndexOutOfBoundsException();
-	}
+        return true;
+    }
 
-	/**
-	 * Answers an integer hash code for the receiver. Objects which are equal
-	 * answer the same value for this method.
-	 * 
-	 * @return the receiver's hash
-	 * 
-	 * @see #equals
-	 */
-	public int hashCode() {
-		if (hashCode == 0) {
-			int hash = 0, multiplier = 1;
-			for (int i = offset + count - 1; i >= offset; i--) {
-				hash += value[i] * multiplier;
-				int shifted = multiplier << 5;
-				multiplier = shifted - multiplier;
-			}
-			hashCode = hash;
-		}
-		return hashCode;
-	}
+    /**
+     * @com.intel.drl.spec_ref 
+     */
+    public boolean equals(Object anObject) {
+        if (!(anObject instanceof String)) {
+            return false;
+        }
+        String str = (String)anObject;
+        if (count != str.count) {
+            return false;
+        }
+        int j = str.offset;
+        int k = offset + count;
+        for (int i = offset; i < k; i++, j++) {
+            if (value[i] != str.value[j]) {
+                return false;
+            }
+        }
+        return true;
+    }
 
-	/**
-	 * Searches in this String for the first index of the specified character.
-	 * The search for the character starts at the beginning and moves towards
-	 * the end of this String.
-	 * 
-	 * @param c
-	 *            the character to find
-	 * @return the index in this String of the specified character, -1 if the
-	 *         character isn't found
-	 * 
-	 * @see #lastIndexOf(int)
-	 * @see #lastIndexOf(int, int)
-	 * @see #lastIndexOf(String)
-	 * @see #lastIndexOf(String, int)
-	 */
-	public int indexOf(int c) {
-		return indexOf(c, 0);
-	}
+    /**
+     * @com.intel.drl.spec_ref 
+     */
+    public boolean equalsIgnoreCase(String anotherString) {
+        if ((anotherString == null) || (count != anotherString.count)) {
+            return false;
+        }
+        int j = anotherString.offset;
+        int k = offset + count;
+        for (int i = offset; i < k; i++, j++) {
+            char ch1 = value[i];
+            char ch2 = anotherString.value[j];
+            if ((ch1 != ch2)
+                && (Character.toLowerCase(ch1) != Character.toLowerCase(ch2))
+                && (Character.toUpperCase(ch1) != Character.toUpperCase(ch2))) {
+                return false;
+            }
+        }
+        return true;
+    }
 
-	/**
-	 * Searches in this String for the index of the specified character. The
-	 * search for the character starts at the specified offset and moves towards
-	 * the end of this String.
-	 * 
-	 * @param c
-	 *            the character to find
-	 * @param start
-	 *            the starting offset
-	 * @return the index in this String of the specified character, -1 if the
-	 *         character isn't found
-	 * 
-	 * @see #lastIndexOf(int)
-	 * @see #lastIndexOf(int, int)
-	 * @see #lastIndexOf(String)
-	 * @see #lastIndexOf(String, int)
-	 */
-	public int indexOf(int c, int start) {
-		if (start < count) {
-			if (start < 0)
-				start = 0;
-			for (int i = offset + start; i < offset + count; i++) {
-				if (value[i] == c)
-					return i - offset;
-			}
-		}
-		return -1;
-	}
+    /**
+     * @com.intel.drl.spec_ref 
+     */
+    public byte[] getBytes() {
+        Charset cs = getDefaultCharset();
+        CharBuffer cb = CharBuffer.allocate(count);
+        cb.put(value, offset, count);
+        cb.position(0);
+        ByteBuffer bb = cs.encode(cb);
+        byte[] b = new byte[bb.limit()];
+        bb.get(b);
+        return b;
+    }
 
-	/**
-	 * Searches in this String for the first index of the specified string. The
-	 * search for the string starts at the beginning and moves towards the end
-	 * of this String.
-	 * 
-	 * @param string
-	 *            the string to find
-	 * @return the index in this String of the specified string, -1 if the
-	 *         string isn't found
-	 * 
-	 * @throws NullPointerException
-	 *             when string is null
-	 * 
-	 * @see #lastIndexOf(int)
-	 * @see #lastIndexOf(int, int)
-	 * @see #lastIndexOf(String)
-	 * @see #lastIndexOf(String, int)
-	 * 
-	 */
-	public int indexOf(String string) {
-		return indexOf(string, 0);
-	}
+    /**
+     * @com.intel.drl.spec_ref 
+     */
+    public void getBytes(int srcBegin, int srcEnd, byte[] dst, int dstBegin) {
+        if (srcBegin < 0) {
+            throw new StringIndexOutOfBoundsException(srcBegin);
+        }
+        if (srcBegin > srcEnd) {
+            throw new StringIndexOutOfBoundsException(srcEnd - srcBegin);
+        }
+        if (srcEnd > count) {
+            throw new StringIndexOutOfBoundsException(srcEnd);
+        }
+        int length = offset + srcEnd;
+        for (int i = offset + srcBegin; i < length; i++, dstBegin++) {
+            dst[dstBegin] = (byte)value[i];
+        }
+    }
 
-	/**
-	 * Searches in this String for the index of the specified string. The search
-	 * for the string starts at the specified offset and moves towards the end
-	 * of this String.
-	 * 
-	 * @param subString
-	 *            the string to find
-	 * @param start
-	 *            the starting offset
-	 * @return the index in this String of the specified string, -1 if the
-	 *         string isn't found
-	 * 
-	 * @throws NullPointerException
-	 *             when string is null
-	 * 
-	 * @see #lastIndexOf(int)
-	 * @see #lastIndexOf(int, int)
-	 * @see #lastIndexOf(String)
-	 * @see #lastIndexOf(String, int)
-	 */
-	public int indexOf(String subString, int start) {
-		if (start < 0)
-			start = 0;
-		int subCount = subString.count;
-		if (subCount > 0) {
-			if (subCount + start > count)
-				return -1;
-			char[] target = subString.value;
-			int subOffset = subString.offset;
-			char firstChar = target[subOffset];
-			int end = subOffset + subCount;
-			while (true) {
-				int i = indexOf(firstChar, start);
-				if (i == -1 || subCount + i > count)
-					return -1; // handles subCount > count || start >= count
-				int o1 = offset + i, o2 = subOffset;
-				while (++o2 < end && value[++o1] == target[o2]) {
-					// Intentionally empty
-				}
-				if (o2 == end) {
-					return i;
-				}
-				start = i + 1;
-			}
-		}
-		return start < count ? start : count;
-	}
+    /**
+     * @com.intel.drl.spec_ref 
+     */
+    public byte[] getBytes(String charsetName)
+        throws UnsupportedEncodingException {
+        Charset cs;
+        try {
+            cs = Charset.forName(charsetName);
+        } catch (Exception ex) {
+            UnsupportedEncodingException throwEx = new UnsupportedEncodingException();
+            throwEx.initCause(ex);
+            throw throwEx;
+        }
+        CharBuffer cb = CharBuffer.allocate(count);
+        cb.put(value, offset, count);
+        cb.position(0);
+        ByteBuffer bb = cs.encode(cb);
+        byte[] b = new byte[bb.limit()];
+        bb.get(b);
+        return b;
+    }
 
-	/**
-	 * Only this native must be implemented, the implementation for the rest of
-	 * this class is provided.
-	 * 
-	 * Searches an internal table of strings for a string equal to this String.
-	 * If the string is not in the table, it is added. Answers the string
-	 * contained in the table which is equal to this String. The same string
-	 * object is always answered for strings which are equal.
-	 * 
-	 * @return the interned string equal to this String
-	 */
-	//public native String intern();
-    private String [] internArray = new String[256];
-    public String intern()
-    {
-        //System.out.println("String.intern() has a very crude, simple implemention");
-
-        for (int ii = 0; ii < internArray.length; ii++) 
-        {
-            if (this.equals(internArray[ii]))
-                return internArray[ii];
-            if (internArray[ii] == null) 
-            {
-                internArray[ii] = this;
-                return this;
-            }
+    /**
+     * @com.intel.drl.spec_ref 
+     */
+    public void getChars(int srcBegin, int srcEnd, char[] dst, int dstBegin) {
+        if (srcBegin < 0) {
+            throw new StringIndexOutOfBoundsException(srcBegin);
+        }
+        if (srcEnd - srcBegin < 0) {
+            throw new StringIndexOutOfBoundsException(srcEnd - srcBegin);
         }
-        int ii = 0;
-        while (true) 
-        {
-            System.out.println("String.intern() --- error, overflowed intern storage");
-            ii++;
+        if (srcEnd > count) {
+            throw new StringIndexOutOfBoundsException(srcEnd);
         }
+        if (dstBegin < 0) {
+            throw new StringIndexOutOfBoundsException(dstBegin);
+        }
+        if (dstBegin + srcEnd - srcBegin > dst.length) {
+            throw new StringIndexOutOfBoundsException(dst.length - dstBegin
+                - srcEnd + srcBegin);
+        }
+        System.arraycopy(value, offset + srcBegin, dst, dstBegin, srcEnd
+            - srcBegin);
     }
 
+    /**
+     * @com.intel.drl.spec_ref 
+     */
+    public int hashCode() {
+        if (hashCode != 0) {
+            return hashCode;
+        }
+        int sum = 0;
+        int j = offset + count;
+        for (int i = offset; i < j; i++) {
+            sum = sum * 31 + value[i];
+        }
+        return hashCode = sum;
+    }
 
-	/**
-	 * Searches in this String for the last index of the specified character.
-	 * The search for the character starts at the end and moves towards the
-	 * beginning of this String.
-	 * 
-	 * @param c
-	 *            the character to find
-	 * @return the index in this String of the specified character, -1 if the
-	 *         character isn't found
-	 * 
-	 * @see #lastIndexOf(int)
-	 * @see #lastIndexOf(int, int)
-	 * @see #lastIndexOf(String)
-	 * @see #lastIndexOf(String, int)
-	 */
-	public int lastIndexOf(int c) {
-		return lastIndexOf(c, count - 1);
-	}
-
-	/**
-	 * Searches in this String for the index of the specified character. The
-	 * search for the character starts at the specified offset and moves towards
-	 * the beginning of this String.
-	 * 
-	 * @param c
-	 *            the character to find
-	 * @param start
-	 *            the starting offset
-	 * @return the index in this String of the specified character, -1 if the
-	 *         character isn't found
-	 * 
-	 * @see #lastIndexOf(int)
-	 * @see #lastIndexOf(int, int)
-	 * @see #lastIndexOf(String)
-	 * @see #lastIndexOf(String, int)
-	 */
-	public int lastIndexOf(int c, int start) {
-		if (start >= 0) {
-			if (start >= count)
-				start = count - 1;
-			for (int i = offset + start; i >= offset; --i) {
-				if (value[i] == c)
-					return i - offset;
-			}
-		}
-		return -1;
-	}
+    /**
+     * @com.intel.drl.spec_ref 
+     */
+    public int indexOf(int ch) {
+        int j = offset + count;
+        for (int i = offset; i < j; i++) {
+            if (value[i] == ch) {
+                return i - offset;
+            }
+        }
+        return -1;
+    }
 
-	/**
-	 * Searches in this String for the last index of the specified string. The
-	 * search for the string starts at the end and moves towards the beginning
-	 * of this String.
-	 * 
-	 * @param string
-	 *            the string to find
-	 * @return the index in this String of the specified string, -1 if the
-	 *         string isn't found
-	 * 
-	 * @throws NullPointerException
-	 *             when string is null
-	 * 
-	 * @see #lastIndexOf(int)
-	 * @see #lastIndexOf(int, int)
-	 * @see #lastIndexOf(String)
-	 * @see #lastIndexOf(String, int)
-	 */
-	public int lastIndexOf(String string) {
-		// Use count instead of count - 1 so lastIndexOf("") answers count
-		return lastIndexOf(string, count);
-	}
+    /**
+     * @com.intel.drl.spec_ref 
+     */
+    public int indexOf(int ch, int fromIndex) {
+        if (fromIndex < 0) {
+            fromIndex = 0;
+        }
+        int j = offset + count;
+        for (int i = offset + fromIndex; i < j; i++) {
+            if (value[i] == ch) {
+                return i - offset;
+            }
+        }
+        return -1;
+    }
 
-	/**
-	 * Searches in this String for the index of the specified string. The search
-	 * for the string starts at the specified offset and moves towards the
-	 * beginning of this String.
-	 * 
-	 * @param subString
-	 *            the string to find
-	 * @param start
-	 *            the starting offset
-	 * @return the index in this String of the specified string, -1 if the
-	 *         string isn't found
-	 * 
-	 * @throws NullPointerException
-	 *             when string is null
-	 * 
-	 * @see #lastIndexOf(int)
-	 * @see #lastIndexOf(int, int)
-	 * @see #lastIndexOf(String)
-	 * @see #lastIndexOf(String, int)
-	 */
-	public int lastIndexOf(String subString, int start) {
-		int subCount = subString.count;
-		if (subCount <= count && start >= 0) {
-			if (subCount > 0) {
-				if (start > count - subCount)
-					start = count - subCount; // count and subCount are both
-				// >= 1
-				char[] target = subString.value;
-				int subOffset = subString.offset;
-				char firstChar = target[subOffset];
-				int end = subOffset + subCount;
-				while (true) {
-					int i = lastIndexOf(firstChar, start);
-					if (i == -1)
-						return -1;
-					int o1 = offset + i, o2 = subOffset;
-					while (++o2 < end && value[++o1] == target[o2]) {
-						// Intentionally empty
-					}
-					if (o2 == end) {
-						return i;
-					}
-					start = i - 1;
-				}
-			}
-			return start < count ? start : count;
-		}
-		return -1;
-	}
+    /**
+     * @com.intel.drl.spec_ref 
+     */
+    public int indexOf(String str) {
+        if (str.count > 0) {
+            int len = offset + count - str.count + 1;
+            char firstChar = str.value[str.offset];
+            for (int i = offset; i < len; i++) {
+                if (value[i] == firstChar) {
+                    if (strMatches(str, i)) {
+                        return i - offset;
+                    }
+                }
+            }
+        } else {
+            return 0;
+        }
+        return -1;
+    }
 
-	/**
-	 * Answers the size of this String.
-	 * 
-	 * @return the number of characters in this String
-	 */
-	public int length() {
-		return count;
-	}
+    /**
+     * @com.intel.drl.spec_ref 
+     */
+    public int indexOf(String str, int fromIndex) {
+        if (fromIndex < 0) {
+            fromIndex = 0;
+        }
+        if (str.count > 0) {
+            fromIndex = fromIndex + offset;
+            int len = offset + count - str.count + 1;
+            char firstChar = str.value[str.offset];
+            for (; fromIndex < len; fromIndex++) {
+                if (value[fromIndex] == firstChar) {
+                    if (strMatches(str, fromIndex)) {
+                        return fromIndex - offset;
+                    }
+                }
+            }
+        } else {
+            return fromIndex > count ? count : fromIndex;
+        }
+        return -1;
+    }
 
-	/**
-	 * Compares the specified string to this String and compares the specified
-	 * range of characters to determine if they are the same.
-	 * 
-	 * @param thisStart
-	 *            the starting offset in this String
-	 * @param string
-	 *            the string to compare
-	 * @param start
-	 *            the starting offset in string
-	 * @param length
-	 *            the number of characters to compare
-	 * @return true if the ranges of characters is equal, false otherwise
-	 * 
-	 * @throws NullPointerException
-	 *             when string is null
-	 */
-	public boolean regionMatches(int thisStart, String string, int start,
-			int length) {
-		if (string == null)
-			throw new NullPointerException();
-		if (start < 0 || string.count - start < length)
-			return false;
-		if (thisStart < 0 || count - thisStart < length)
-			return false;
-		if (length <= 0)
-			return true;
-		int o1 = offset + thisStart, o2 = string.offset + start;
-		for (int i = 0; i < length; ++i) {
-			if (value[o1 + i] != string.value[o2 + i])
-				return false;
-		}
-		return true;
-	}
 
-	/**
-	 * Compares the specified string to this String and compares the specified
-	 * range of characters to determine if they are the same. When ignoreCase is
-	 * true, the case of the characters is ignored during the comparison.
-	 * 
-	 * @param ignoreCase
-	 *            specifies if case should be ignored
-	 * @param thisStart
-	 *            the starting offset in this String
-	 * @param string
-	 *            the string to compare
-	 * @param start
-	 *            the starting offset in string
-	 * @param length
-	 *            the number of characters to compare
-	 * @return true if the ranges of characters is equal, false otherwise
-	 * 
-	 * @throws NullPointerException
-	 *             when string is null
-	 */
-	public boolean regionMatches(boolean ignoreCase, int thisStart,
-			String string, int start, int length) {
-		if (!ignoreCase)
-			return regionMatches(thisStart, string, start, length);
+    /**
+     * @com.intel.drl.spec_ref 
+     */
+    public int lastIndexOf(int ch) {
+        for (int i = offset + count - 1; i >= offset; i--) {
+            if (value[i] == ch) {
+                return i - offset;
+            }
+        }
+        return -1;
+    }
 
-		if (string != null) {
-			if (thisStart < 0 || length > count - thisStart)
-				return false;
-			if (start < 0 || length > string.count - start)
-				return false;
+    /**
+     * @com.intel.drl.spec_ref 
+     */
+    public int lastIndexOf(int ch, int fromIndex) {
+        if (fromIndex >= count) {
+            fromIndex = count - 1;
+        }
+        for (int i = offset + fromIndex; i >= offset; i--) {
+            if (value[i] == ch) {
+                return i - offset;
+            }
+        }
+        return -1;
+    }
 
-			thisStart += offset;
-			start += string.offset;
-			int end = thisStart + length;
-			char c1, c2;
-			char[] target = string.value;
-			while (thisStart < end) {
-				if ((c1 = value[thisStart++]) != (c2 = target[start++])
-						&& Character.toUpperCase(c1) != Character
-								.toUpperCase(c2)
-						// Required for unicode that we test both cases
-						&& Character.toLowerCase(c1) != Character
-								.toLowerCase(c2)) {
-					return false;
-				}
-			}
-			return true;
-		}
-		throw new NullPointerException();
-	}
+    /**
+     * @com.intel.drl.spec_ref 
+     */
+    public int lastIndexOf(String str) {
+        if (str.count > 0) {
+            char firstChar = str.value[str.offset];
+            for (int i = offset + count - str.count; i >= offset; i--) {
+                if (value[i] == firstChar) {
+                    if (strMatches(str, i)) {
+                        return i - offset;
+                    }
+                }
+            }
+        } else {
+            return count;
+        }
+        return -1;
+    }
 
-	/**
-	 * Copies this String replacing occurrences of the specified character with
-	 * another character.
-	 * 
-	 * @param oldChar
-	 *            the character to replace
-	 * @param newChar
-	 *            the replacement character
-	 * @return a new String with occurrences of oldChar replaced by newChar
-	 */
-	public String replace(char oldChar, char newChar) {
-		int index = indexOf(oldChar, 0);
-		if (index == -1)
-			return this;
-
-		char[] buffer = new char[count];
-		System.arraycopy(value, offset, buffer, 0, count);
-		do {
-			buffer[index++] = newChar;
-		} while ((index = indexOf(oldChar, index)) != -1);
-		return new String(0, count, buffer);
-	}
+    /**
+     * @com.intel.drl.spec_ref 
+     */
+    public int lastIndexOf(String str, int fromIndex) {
+        if (fromIndex > count - str.count) {
+            fromIndex = count - str.count;
+        }
+        if (str.count > 0) {
+            fromIndex = fromIndex + offset;
+            char firstChar = str.value[str.offset];
+            for (; fromIndex >= offset; fromIndex--) {
+                if (value[fromIndex] == firstChar) {
+                    if (strMatches(str, fromIndex)) {
+                        return fromIndex - offset;
+                    }
+                }
+            }
+        } else {
+            return fromIndex >= 0 ? fromIndex : -1;
+        }
+        return -1;
+    }
 
-	/**
-	 * Compares the specified string to this String to determine if the
-	 * specified string is a prefix.
-	 * 
-	 * @param prefix
-	 *            the string to look for
-	 * @return true when the specified string is a prefix of this String, false
-	 *         otherwise
-	 * 
-	 * @throws NullPointerException
-	 *             when prefix is null
-	 */
-	public boolean startsWith(String prefix) {
-		return startsWith(prefix, 0);
-	}
+    /**
+     * @com.intel.drl.spec_ref 
+     */
+    public int length() {
+        return count;
+    }
 
-	/**
-	 * Compares the specified string to this String, starting at the specified
-	 * offset, to determine if the specified string is a prefix.
-	 * 
-	 * @param prefix
-	 *            the string to look for
-	 * @param start
-	 *            the starting offset
-	 * @return true when the specified string occurs in this String at the
-	 *         specified offset, false otherwise
-	 * 
-	 * @throws NullPointerException
-	 *             when prefix is null
-	 */
-	public boolean startsWith(String prefix, int start) {
-		return regionMatches(start, prefix, 0, prefix.count);
-	}
+    /**
+     * @com.intel.drl.spec_ref 
+     */
+    public boolean matches(String regex) {
+        return Pattern.matches(regex, this);
+    }
 
-	/**
-	 * Copies a range of characters into a new String.
-	 * 
-	 * @param start
-	 *            the offset of the first character
-	 * @return a new String containing the characters from start to the end of
-	 *         the string
-	 * 
-	 * @throws IndexOutOfBoundsException
-	 *             when <code>start < 0</code> or
-	 *             <code>start > length()</code>
-	 */
-	public String substring(int start) {
-		if (0 <= start && start <= count)
-			return new String(offset + start, count - start, value);
-		throw new StringIndexOutOfBoundsException(start);
-	}
+    /**
+     * @com.intel.drl.spec_ref 
+     */
+    public boolean regionMatches(boolean ignoreCase, int toffset, String other,
+        int ooffset, int len) {
+        if (ooffset + len > other.count || toffset < 0 || ooffset < 0
+            || toffset + len > count) {
+            return false;
+        }
+        toffset = toffset + offset;
+        ooffset = ooffset + other.offset;
+        int firstLen = toffset + len;
+        for (; toffset < firstLen; toffset++, ooffset++) {
+            char c1 = value[toffset];
+            char c2 = other.value[ooffset];
+            if (c1 != c2
+                && (!ignoreCase || (Character.toLowerCase(c1) != Character
+                    .toLowerCase(c2) && Character.toUpperCase(c1) != Character
+                    .toUpperCase(c2)))) {
+                return false;
+            }
+        }
+        return true;
+    }
 
-	/**
-	 * Copies a range of characters into a new String.
-	 * 
-	 * @param start
-	 *            the offset of the first character
-	 * @param end
-	 *            the offset one past the last character
-	 * @return a new String containing the characters from start to end - 1
-	 * 
-	 * @throws IndexOutOfBoundsException
-	 *             when <code>start < 0, start > end</code> or
-	 *             <code>end > length()</code>
-	 */
-	public String substring(int start, int end) {
-		// NOTE last character not copied!
-		// Fast range check.
-		if (0 <= start && start <= end && end <= count)
-			return new String(offset + start, end - start, value);
-		throw new StringIndexOutOfBoundsException();
-	}
+    /**
+     * @com.intel.drl.spec_ref 
+     */
+    public boolean regionMatches(int toffset, String other, int ooffset, int len) {
+        if (ooffset + len > other.count || toffset < 0 || ooffset < 0
+            || toffset + len > count) {
+            return false;
+        }
+        toffset = toffset + offset;
+        ooffset = ooffset + other.offset;
+        int firstLen = toffset + len;
+        for (; toffset < firstLen; toffset++, ooffset++) {
+            char c1 = value[toffset];
+            char c2 = other.value[ooffset];
+            if (c1 != c2) {
+                return false;
+            }
+        }
+        return true;
+    }
 
-	/**
-	 * Copies the characters in this String to a character array.
-	 * 
-	 * @return a character array containing the characters of this String
-	 */
-	public char[] toCharArray() {
-		char[] buffer = new char[count];
-		System.arraycopy(value, offset, buffer, 0, count);
-		return buffer;
-	}
+    /**
+     * @com.intel.drl.spec_ref 
+     */
+    public String replace(char oldChar, char newChar) {
+        if (oldChar != newChar) {
+            int i;
+            boolean replaced = false;
+            char[] ch = new char[count];
+            for (i = 0; i < count; i++) {
+                if (value[i + offset] == oldChar) {
+                    System.arraycopy(value, offset, ch, 0, count);
+                    ch[i] = newChar;
+                    replaced = true;
+                    break;
+                }
+            }
+            for (++i; i < count; i++) {
+                if (ch[i] == oldChar) {
+                    ch[i] = newChar;
+                }
+            }
+            if (replaced) {
+                return new String(0, count, ch);
+            }
+        }
+        return this;
+    }
 
-	/**
-	 * Converts the characters in this String to lowercase, using the default
-	 * Locale.
-	 * 
-	 * @return a new String containing the lowercase characters equivalent to
-	 *         the characters in this String
-	 */
-	public String toLowerCase() {
-		return toLowerCase(Locale.getDefault());
-	}
+    /**
+     * @com.intel.drl.spec_ref 
+     */
+    public String replaceAll(String regex, String replacement) {
+        return Pattern.compile(regex).matcher(this).replaceAll(replacement);
+    }
 
-	/**
-	 * Converts the characters in this String to lowercase, using the specified
-	 * Locale.
-	 * 
-	 * @param locale
-	 *            the Locale
-	 * @return a new String containing the lowercase characters equivalent to
-	 *         the characters in this String
-	 */
-	public String toLowerCase(Locale locale) {
-		for (int o = offset, end = offset + count; o < end; o++) {
-			char ch = value[o];
-			if (ch != Character.toLowerCase(ch)) {
-				char[] buffer = new char[count];
-				int i = o - offset;
-				System.arraycopy(value, offset, buffer, 0, i); // not worth
-				// checking for
-				// i == 0 case
-				if (locale.getLanguage() != "tr") { // Turkish
-					while (i < count)
-						buffer[i++] = Character.toLowerCase(value[o++]);
-				} else {
-					while (i < count)
-						buffer[i++] = (ch = value[o++]) != 0x49 ? Character
-								.toLowerCase(ch) : (char) 0x131;
-				}
-				return new String(0, count, buffer);
-			}
-		}
-		return this;
-	}
+    /**
+     * @com.intel.drl.spec_ref 
+     */
+    public String replaceFirst(String regex, String replacement) {
+        return Pattern.compile(regex).matcher(this).replaceFirst(replacement);
+    }
 
-	/**
-	 * Answers a string containing a concise, human-readable description of the
-	 * receiver.
-	 * 
-	 * @return this String
-	 */
-	public String toString() {
-		return this;
-	}
+    /**
+     * @com.intel.drl.spec_ref 
+     */
+    public String[] split(String regex) {
+        return Pattern.compile(regex).split(this, 0);
+    }
 
-	/**
-	 * Converts the characters in this String to uppercase, using the default
-	 * Locale.
-	 * 
-	 * @return a new String containing the uppercase characters equivalent to
-	 *         the characters in this String
-	 */
-	public String toUpperCase() {
-		return toUpperCase(Locale.getDefault());
-	}
+    /**
+     * @com.intel.drl.spec_ref 
+     */
+    public String[] split(String regex, int limit) {
+        return Pattern.compile(regex).split(this, limit);
+    }
 
-	private static final char[] upperValues = "SS\u0000\u02bcN\u0000J\u030c\u0000\u0399\u0308\u0301\u03a5\u0308\u0301\u0535\u0552\u0000H\u0331\u0000T\u0308\u0000W\u030a\u0000Y\u030a\u0000A\u02be\u0000\u03a5\u0313\u0000\u03a5\u0313\u0300\u03a5\u0313\u0301\u03a5\u0313\u0342\u1f08\u0399\u0000\u1f09\u0399\u0000\u1f0a\u0399\u0000\u1f0b\u0399\u0000\u1f0c\u0399\u0000\u1f0d\u0399\u0000\u1f0e\u0399\u0000\u1f0f\u0399\u0000\u1f08\u0399\u0000\u1f09\u0399\u0000\u1f0a\u0399\u0000\u1f0b\u0399\u0000\u1f0c\u0399\u0000\u1f0d\u0399\u0000\u1f0e\u0399\u0000\u1f0f\u0399\u0000\u1f28\u0399\u0000\u1f29\u0399\u0000\u1f2a\u0399\u0000\u1f2b\u0399\u0000\u1f2c\u0399\u0000\u1f2d\u0399\u0000\u1f2e\u0399\u0000\u1f2f\u0399\u0000\u1f28\u0399\u0000\u1f29\u0399\u0000\u1f2a\u0399\u0000\u1f2b\u0399\u0000\u1f2c\u0399\u0000\u1f2d\u0399\u0000\u1f2e\u0399\u0000\u1f2f\u0399\u0000\u1f68\u0399\u0000\u1f69\u0399\u0000\u1f6a\u0399\u0000\u1f6b\u0399\u0000\u1f6c\u0399\u0000\u1f6d\u0399\u0000\u1f6e\u0399\u0000\u1f6f\u0399\u0000
 \u1f68\u0399\u0000\u1f69\u0399\u0000\u1f6a\u0399\u0000\u1f6b\u0399\u0000\u1f6c\u0399\u0000\u1f6d\u0399\u0000\u1f6e\u0399\u0000\u1f6f\u0399\u0000\u1fba\u0399\u0000\u0391\u0399\u0000\u0386\u0399\u0000\u0391\u0342\u0000\u0391\u0342\u0399\u0391\u0399\u0000\u1fca\u0399\u0000\u0397\u0399\u0000\u0389\u0399\u0000\u0397\u0342\u0000\u0397\u0342\u0399\u0397\u0399\u0000\u0399\u0308\u0300\u0399\u0308\u0301\u0399\u0342\u0000\u0399\u0308\u0342\u03a5\u0308\u0300\u03a5\u0308\u0301\u03a1\u0313\u0000\u03a5\u0342\u0000\u03a5\u0308\u0342\u1ffa\u0399\u0000\u03a9\u0399\u0000\u038f\u0399\u0000\u03a9\u0342\u0000\u03a9\u0342\u0399\u03a9\u0399\u0000FF\u0000FI\u0000FL\u0000FFIFFLST\u0000ST\u0000\u0544\u0546\u0000\u0544\u0535\u0000\u0544\u053b\u0000\u054e\u0546\u0000\u0544\u053d\u0000".value;
+    /**
+     * @com.intel.drl.spec_ref 
+     */
+    public boolean startsWith(String prefix) {
+        if (prefix.count > count) {
+            return false;
+        }
+        int len = prefix.offset + prefix.count;
+        int j = offset;
+        for (int i = prefix.offset; i < len; i++, j++) {
+            if (value[j] != prefix.value[i]) {
+                return false;
+            }
+        }
+        return true;
+    }
 
-	/**
-	 * Return the index of the specified character into the upperValues table.
-	 * The upperValues table contains three entries at each position. These
-	 * three characters are the upper case conversion. If only two characters
-	 * are used, the third character in the table is \u0000.
-	 * 
-	 * @param ch the char being converted to upper case
-	 * 
-	 * @return the index into the upperValues table, or -1
-	 */
-	private int upperIndex(int ch) {
-		int index = -1;
-		if (ch >= 0xdf) {
-			if (ch <= 0x587) {
-				if (ch == 0xdf)
-					index = 0;
-				else if (ch <= 0x149) {
-					if (ch == 0x149)
-						index = 1;
-				} else if (ch <= 0x1f0) {
-					if (ch == 0x1f0)
-						index = 2;
-				} else if (ch <= 0x390) {
-					if (ch == 0x390)
-						index = 3;
-				} else if (ch <= 0x3b0) {
-					if (ch == 0x3b0)
-						index = 4;
-				} else if (ch <= 0x587) {
-					if (ch == 0x587)
-						index = 5;
-				}
-			} else if (ch >= 0x1e96) {
-				if (ch <= 0x1e9a)
-					index = 6 + ch - 0x1e96;
-				else if (ch >= 0x1f50 && ch <= 0x1ffc) {
-					index = "\u000b\u0000\f\u0000\r\u0000\u000e\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u000f\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001a\u001b\u001c\u001d\u001e\u001f !\"#$%&'()*+,-./0123456789:;<=>\u0000\u0000?@A\u0000BC\u0000\u0000\u0000\u0000D\u0000\u0000\u0000\u0000\u0000EFG\u0000HI\u0000\u0000\u0000\u0000J\u0000\u0000\u0000\u0000\u0000KL\u0000\u0000MN\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000OPQ\u0000RS\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000TUV\u0000WX\u0000\u0000\u0000\u0000Y".value[ch - 0x1f50];
-					if (index == 0)
-						index = -1;
-				} else if (ch >= 0xfb00) {
-					if (ch <= 0xfb06)
-						index = 90 + ch - 0xfb00;
-					else if (ch >= 0xfb13 && ch <= 0xfb17)
-						index = 97 + ch - 0xfb13;
-				}
-			}
-		}
-		return index;
-	}
+    /**
+     * @com.intel.drl.spec_ref 
+     */
+    public boolean startsWith(String prefix, int toffset) {
+        if (prefix.count > count - toffset || toffset < 0) {
+            return false;
+        }
+        int len = prefix.offset + prefix.count;
+        int j = offset + toffset;
+        for (int i = prefix.offset; i < len; i++, j++) {
+            if (value[j] != prefix.value[i]) {
+                return false;
+            }
+        }
+        return true;
+    }
 
-	/**
-	 * Converts the characters in this String to uppercase, using the specified
-	 * Locale.
-	 * 
-	 * @param locale
-	 *            the Locale
-	 * @return a new String containing the uppercase characters equivalent to
-	 *         the characters in this String
-	 */
-	public String toUpperCase(Locale locale) {
-		boolean turkish = "tr".equals(locale.getLanguage());
-		char[] output = null;
-		int i = 0;
-		for (int o = offset, end = offset + count; o < end; o++) {
-			char ch = value[o];
-			int index = upperIndex(ch);
-			if (index == -1) {
-				if (output != null && i >= output.length) {
-					char[] newoutput = new char[output.length + (count / 6) + 2];
-					System.arraycopy(output, 0, newoutput, 0, output.length);
-					output = newoutput;
-				}
-				char upch = !turkish ? Character.toUpperCase(ch)
-						: (ch != 0x69 ? Character.toUpperCase(ch)
-								: (char) 0x130);
-				if (ch != upch) {
-					if (output == null) {
-						output = new char[count];
-						i = o - offset;
-						System.arraycopy(value, offset, output, 0, i);
-
-					}
-					output[i++] = upch;
-				} else if (output != null)
-					output[i++] = ch;
-			} else {
-				int target = index * 3;
-				char val3 = upperValues[target + 2];
-				if (output == null) {
-					output = new char[count + (count / 6) + 2];
-					i = o - offset;
-					System.arraycopy(value, offset, output, 0, i);
-				} else if (i + (val3 == 0 ? 1 : 2) >= output.length) {
-					char[] newoutput = new char[output.length + (count / 6) + 3];
-					System.arraycopy(output, 0, newoutput, 0, output.length);
-					output = newoutput;
-				}
-
-				char val = upperValues[target];
-				output[i++] = val;
-				val = upperValues[target + 1];
-				output[i++] = val;
-				if (val3 != 0)
-					output[i++] = val3;
-			}
-		}
-		if (output == null)
-			return this;
-		return output.length == i || output.length - i < 8 ? new String(0, i,
-				output) : new String(output, 0, i);
-	}
+    /**
+     * @com.intel.drl.spec_ref 
+     */
+    public CharSequence subSequence(int beginIndex, int endIndex) {
+        return substring(beginIndex, endIndex);
+    }
 
-	/**
-	 * Copies this String removing white space characters from the beginning and
-	 * end of the string.
-	 * 
-	 * @return a new String with characters <code><= \\u0020</code> removed
-	 *         from the beginning and the end
-	 */
-	public String trim() {
-		int start = offset, last = offset + count - 1;
-		int end = last;
-		while ((start <= end) && (value[start] <= ' '))
-			start++;
-		while ((end >= start) && (value[end] <= ' '))
-			end--;
-		if (start == offset && end == last)
-			return this;
-		return new String(start, end - start + 1, value);
-	}
+    /**
+     * @com.intel.drl.spec_ref 
+     */
+    public String substring(int beginIndex) {
+        return substring(beginIndex, count);
+    }
 
-	/**
-	 * Creates a new String containing the characters in the specified character
-	 * array. Modifying the character array after creating the String has no
-	 * effect on the String.
-	 * 
-	 * @param data
-	 *            the array of characters
-	 * @return the new String
-	 * 
-	 * @throws NullPointerException
-	 *             when data is null
-	 */
-	public static String valueOf(char[] data) {
-		return new String(data, 0, data.length);
-	}
+    /**
+     * @com.intel.drl.spec_ref 
+     */
+    public String substring(int beginIndex, int endIndex) {
+        if (beginIndex < 0) {
+            throw new StringIndexOutOfBoundsException(beginIndex);
+        }
+        if (endIndex > count) {
+            throw new StringIndexOutOfBoundsException(endIndex);
+        }
+        if (beginIndex > endIndex) {
+            throw new StringIndexOutOfBoundsException(endIndex - beginIndex);
+        }
+        return new String(offset + beginIndex, endIndex - beginIndex, value);
+    }
 
-	/**
-	 * Creates a new String containing the specified characters in the character
-	 * array. Modifying the character array after creating the String has no
-	 * effect on the String.
-	 * 
-	 * @param data
-	 *            the array of characters
-	 * @param start
-	 *            the starting offset in the character array
-	 * @param length
-	 *            the number of characters to use
-	 * @return the new String
-	 * 
-	 * @throws IndexOutOfBoundsException
-	 *             when <code>length < 0, start < 0</code> or
-	 *             <code>start + length > data.length</code>
-	 * @throws NullPointerException
-	 *             when data is null
-	 */
-	public static String valueOf(char[] data, int start, int length) {
-		return new String(data, start, length);
-	}
+    /**
+     * @com.intel.drl.spec_ref 
+     */
+    public char[] toCharArray() {
+        char[] chArray = new char[count];
+        System.arraycopy(value, offset, chArray, 0, count);
+        return chArray;
+    }
 
-	/**
-	 * Converts the specified character to its string representation.
-	 * 
-	 * @param value
-	 *            the character
-	 * @return the character converted to a string
-	 */
-	public static String valueOf(char value) {
-		String s;
-		if (value < 128)
-			s = new String(value, 1, ascii);
-		else
-			s = new String(0, 1, new char[] { value });
-		s.hashCode = value;
-		return s;
-	}
+    /**
+     * @com.intel.drl.spec_ref 
+     */
+    public String toLowerCase() {
+        return toLowerCase(Locale.getDefault());
+    }
 
-	/**
-	 * Converts the specified double to its string representation.
-	 * 
-	 * @param value
-	 *            the double
-	 * @return the double converted to a string
-	 */
-	public static String valueOf(double value) {
-		return Double.toString(value);
-	}
+    /**
+     * @com.intel.drl.spec_ref 
+     */
+    public String toLowerCase(Locale locale) {
+        boolean tr = "tr".equals(locale.getLanguage());
+        boolean shouldLC = false;
+        int j = offset + count;
+        if (!tr) {
+            for (int i = offset; i < j; i++) {
+                if (value[i] != Character.toLowerCase(value[i])) {
+                    shouldLC = true;
+                    break;
+                }
+            }
+        } else {
+            for (int i = offset; i < j; i++) {
+                char ch = value[i];
+                if (ch == '\u0049' || ch != Character.toLowerCase(ch)) {
+                    shouldLC = true;
+                    break;
+                }
+            }
+        }
+        if (!shouldLC) {
+            return this;
+        }
+        char[] ch = new char[count];
+        int k = 0;
+        if (!tr) {
+            for (int i = offset; i < j; i++, k++) {
+                ch[k] = Character.toLowerCase(value[i]);
+            }
+            return new String(0, count, ch);
+        } else {
+            for (int i = offset; i < j; i++, k++) {
+                char ch1 = value[i];
+                ch[k] = (tr && ch1 == '\u0049') ? '\u0131' : Character
+                    .toLowerCase(ch1);
+            }
+            return new String(0, count, ch);
+        }
+    }
 
-	/**
-	 * Converts the specified float to its string representation.
-	 * 
-	 * @param value
-	 *            the float
-	 * @return the float converted to a string
-	 */
-	public static String valueOf(float value) {
-		return Float.toString(value);
-	}
+    /**
+     * @com.intel.drl.spec_ref 
+     */
+    public String toString() {
+        return this;
+    }
 
-	/**
-	 * Converts the specified integer to its string representation.
-	 * 
-	 * @param value
-	 *            the integer
-	 * @return the integer converted to a string
-	 */
-	public static String valueOf(int value) {
-		return Integer.toString(value);
-	}
+    /**
+     * @com.intel.drl.spec_ref 
+     */
+    public String toUpperCase() {
+        return toUpperCase(Locale.getDefault());
+    }
 
-	/**
-	 * Converts the specified long to its string representation.
-	 * 
-	 * @param value
-	 *            the long
-	 * @return the long converted to a string
-	 */
-	public static String valueOf(long value) {
-		return Long.toString(value);
-	}
+    /**
+     * @com.intel.drl.spec_ref 
+     */
+    public String toUpperCase(Locale locale) {
+        int index = 0;
+        int indSP;
+        int length = offset + count;
+        char ch;
+        char[] charArray = new char[count * 3];
+        if (!"tr".equals(locale.getLanguage())) {
+            for (int i = offset; i < length; i++) {
+                ch = value[i];
+                if (ch < '\u00df') {
+                    charArray[index++] = Character.toUpperCase(ch);
+                } else if (ch == '\u00df') {
+                    charArray[index++] = '\u0053';
+                    charArray[index++] = '\u0053';
+                } else if (ch == '\u0149') {
+                    charArray[index++] = '\u02bc';
+                    charArray[index++] = '\u004e';
+                } else if (ch == '\u01f0') {
+                    charArray[index++] = '\u004a';
+                    charArray[index++] = '\u030c';
+                } else if (ch == '\u0390') {
+                    charArray[index++] = '\u0399';
+                    charArray[index++] = '\u0308';
+                    charArray[index++] = '\u0301';
+                } else if (ch == '\u03b0') {
+                    charArray[index++] = '\u03a5';
+                    charArray[index++] = '\u0308';
+                    charArray[index++] = '\u0301';
+                } else if (ch == '\u0587') {
+                    charArray[index++] = '\u0535';
+                    charArray[index++] = '\u0552';
+                } else if (ch >= '\u1e96' && ch <= '\u1e9a') {
+                    indSP = (ch - '\u1e96') * 2;
+                    charArray[index++] = charUpperSpecial[indSP++];
+                    charArray[index++] = charUpperSpecial[indSP];
+                } else if (ch >= '\u1f50' && ch <= '\u1ffc') {
+                    indSP = indexUp[ch - '\u1f50'] * 3;
+                    if (indSP == 0) {
+                        charArray[index++] = Character.toUpperCase(ch);
+                    } else {
+                        charArray[index++] = charUpperSpecial[indSP++];
+                        charArray[index++] = charUpperSpecial[indSP++];
+                        if (charUpperSpecial[indSP] > 0) {
+                            charArray[index++] = charUpperSpecial[indSP];
+                        }
+                    }
+                } else if (ch >= '\ufb00' && ch <= '\ufb17') {
+                    indSP = indexUp1[ch - '\ufb00'] * 3;
+                    if (indSP == 0) {
+                        charArray[index++] = Character.toUpperCase(ch);
+                    } else {
+                        charArray[index++] = charUpperSpecial[indSP++];
+                        charArray[index++] = charUpperSpecial[indSP++];
+                        if (charUpperSpecial[indSP] > 0) {
+                            charArray[index++] = charUpperSpecial[indSP];
+                        }
+                    }
+                } else {
+                    charArray[index++] = Character.toUpperCase(ch);
+                }
+            }
+        } else {
+            for (int i = offset; i < length; i++) {
+                ch = value[i];
+                if (ch < '\u00df') {
+                    charArray[index++] = ch == '\u0069' ? '\u0130' : Character
+                        .toUpperCase(ch);
+                } else if (ch == '\u00df') {
+                    charArray[index++] = '\u0053';
+                    charArray[index++] = '\u0053';
+                } else if (ch == '\u0149') {
+                    charArray[index++] = '\u02bc';
+                    charArray[index++] = '\u004e';
+                } else if (ch == '\u01f0') {
+                    charArray[index++] = '\u004a';
+                    charArray[index++] = '\u030c';
+                } else if (ch == '\u0390') {
+                    charArray[index++] = '\u0399';
+                    charArray[index++] = '\u0308';
+                    charArray[index++] = '\u0301';
+                } else if (ch == '\u03b0') {
+                    charArray[index++] = '\u03a5';
+                    charArray[index++] = '\u0308';
+                    charArray[index++] = '\u0301';
+                } else if (ch == '\u0587') {
+                    charArray[index++] = '\u0535';
+                    charArray[index++] = '\u0552';
+                } else if (ch >= '\u1e96' && ch <= '\u1e9a') {
+                    indSP = (ch - '\u1e96') * 2;
+                    charArray[index++] = charUpperSpecial[indSP++];
+                    charArray[index++] = charUpperSpecial[indSP];
+                } else if (ch >= '\u1f50' && ch <= '\u1ffc') {
+                    indSP = indexUp[ch - '\u1f50'] * 3;
+                    if (indSP == 0) {
+                        charArray[index++] = ch == '\u0069' ? '\u0130'
+                            : Character.toUpperCase(ch);
+                    } else {
+                        charArray[index++] = charUpperSpecial[indSP++];
+                        charArray[index++] = charUpperSpecial[indSP++];
+                        if (charUpperSpecial[indSP] > 0) {
+                            charArray[index++] = charUpperSpecial[indSP];
+                        }
+                    }
+                } else if (ch >= '\ufb00' && ch <= '\ufb17') {
+                    indSP = indexUp1[ch - '\ufb00'] * 3;
+                    if (indSP == 0) {
+                        charArray[index++] = ch == '\u0069' ? '\u0130'
+                            : Character.toUpperCase(ch);
+                    } else {
+                        charArray[index++] = charUpperSpecial[indSP++];

[... 293 lines stripped ...]


Mime
View raw message