70 |
* literal in the object stream. |
* literal in the object stream. |
71 |
* |
* |
72 |
* @author Paul N. Fisher |
* @author Paul N. Fisher |
73 |
* @author Eric Blake <ebb9@email.byu.edu> |
* @author Eric Blake (ebb9@email.byu.edu) |
74 |
* @author Per Bothner <bothner@cygnus.com> |
* @author Per Bothner (bothner@cygnus.com) |
75 |
* @since 1.0 |
* @since 1.0 |
76 |
* @status updated to 1.4; but could use better data sharing via offset field |
* @status updated to 1.4; but could use better data sharing via offset field |
77 |
*/ |
*/ |
223 |
* @param count the number of characters from data to copy |
* @param count the number of characters from data to copy |
224 |
* @throws NullPointerException if data is null |
* @throws NullPointerException if data is null |
225 |
* @throws IndexOutOfBoundsException if (offset < 0 || count < 0 |
* @throws IndexOutOfBoundsException if (offset < 0 || count < 0 |
226 |
* || offset + count > data.length) |
* || offset + count > data.length) |
227 |
* (while unspecified, this is a StringIndexOutOfBoundsException) |
* (while unspecified, this is a StringIndexOutOfBoundsException) |
228 |
*/ |
*/ |
229 |
public String(char[] data, int offset, int count) |
public String(char[] data, int offset, int count) |
237 |
* corresponding byte b, is created in the new String as if by performing: |
* corresponding byte b, is created in the new String as if by performing: |
238 |
* |
* |
239 |
* <pre> |
* <pre> |
240 |
* c = (char) (((hibyte & 0xff) << 8) | (b & 0xff)) |
* c = (char) (((hibyte & 0xff) << 8) | (b & 0xff)) |
241 |
* </pre> |
* </pre> |
242 |
* |
* |
243 |
* @param ascii array of integer values |
* @param ascii array of integer values |
246 |
* @param count the number of characters from ascii to copy |
* @param count the number of characters from ascii to copy |
247 |
* @throws NullPointerException if ascii is null |
* @throws NullPointerException if ascii is null |
248 |
* @throws IndexOutOfBoundsException if (offset < 0 || count < 0 |
* @throws IndexOutOfBoundsException if (offset < 0 || count < 0 |
249 |
* || offset + count > ascii.length) |
* || offset + count > ascii.length) |
250 |
* (while unspecified, this is a StringIndexOutOfBoundsException) |
* (while unspecified, this is a StringIndexOutOfBoundsException) |
251 |
* @see #String(byte[]) |
* @see #String(byte[]) |
252 |
* @see #String(byte[], String) |
* @see #String(byte[], String) |
274 |
* as if by performing: |
* as if by performing: |
275 |
* |
* |
276 |
* <pre> |
* <pre> |
277 |
* c = (char) (((hibyte & 0xff) << 8) | (b & 0xff)) |
* c = (char) (((hibyte & 0xff) << 8) | (b & 0xff)) |
278 |
* </pre> |
* </pre> |
279 |
* |
* |
280 |
* @param ascii array of integer values |
* @param ascii array of integer values |
788 |
* @param ignoreCase true if case should be ignored in comparision |
* @param ignoreCase true if case should be ignored in comparision |
789 |
* @param toffset index to start comparison at for this String |
* @param toffset index to start comparison at for this String |
790 |
* @param other String to compare region to this String |
* @param other String to compare region to this String |
791 |
* @param ooffset index to start comparison at for other |
* @param oofset index to start comparison at for other |
792 |
* @param len number of characters to compare |
* @param len number of characters to compare |
793 |
* @return true if regions match, false otherwise |
* @return true if regions match, false otherwise |
794 |
* @throws NullPointerException if other is null |
* @throws NullPointerException if other is null |
1034 |
* Creates a substring of this String, starting at a specified index |
* Creates a substring of this String, starting at a specified index |
1035 |
* and ending at one character before a specified index. |
* and ending at one character before a specified index. |
1036 |
* |
* |
1037 |
* @param beginIndex index to start substring (inclusive, base 0) |
* @param begin index to start substring (inclusive, base 0) |
1038 |
* @param endIndex index to end at (exclusive) |
* @param end index to end at (exclusive) |
1039 |
* @return new String which is a substring of this String |
* @return new String which is a substring of this String |
1040 |
* @throws IndexOutOfBoundsException if begin < 0 || end > length() |
* @throws IndexOutOfBoundsException if begin < 0 || end > length() |
1041 |
* || begin > end (while unspecified, this is a |
* || begin > end (while unspecified, this is a |
1042 |
* StringIndexOutOfBoundsException) |
* StringIndexOutOfBoundsException) |
1043 |
*/ |
*/ |
1044 |
public String substring(int beginIndex, int endIndex) |
public String substring(int beginIndex, int endIndex) |
1056 |
/** |
/** |
1057 |
* Creates a substring of this String, starting at a specified index |
* Creates a substring of this String, starting at a specified index |
1058 |
* and ending at one character before a specified index. This behaves like |
* and ending at one character before a specified index. This behaves like |
1059 |
* <code>substring(beginIndex, endIndex)</code>. |
* <code>substring(begin, end)</code>. |
1060 |
* |
* |
1061 |
* @param beginIndex index to start substring (inclusive, base 0) |
* @param begin index to start substring (inclusive, base 0) |
1062 |
* @param endIndex index to end at (exclusive) |
* @param end index to end at (exclusive) |
1063 |
* @return new String which is a substring of this String |
* @return new String which is a substring of this String |
1064 |
* @throws IndexOutOfBoundsException if begin < 0 || end > length() |
* @throws IndexOutOfBoundsException if begin < 0 || end > length() |
1065 |
* || begin > end |
* || begin > end |
1066 |
* @since 1.4 |
* @since 1.4 |
1067 |
*/ |
*/ |
1068 |
public CharSequence subSequence(int beginIndex, int endIndex) |
public CharSequence subSequence(int begin, int end) |
1069 |
{ |
{ |
1070 |
return substring(beginIndex, endIndex); |
return substring(begin, end); |
1071 |
} |
} |
1072 |
|
|
1073 |
/** |
/** |
1470 |
* @return String containing the chars from data[offset..offset+count] |
* @return String containing the chars from data[offset..offset+count] |
1471 |
* @throws NullPointerException if data is null |
* @throws NullPointerException if data is null |
1472 |
* @throws IndexOutOfBoundsException if (offset < 0 || count < 0 |
* @throws IndexOutOfBoundsException if (offset < 0 || count < 0 |
1473 |
* || offset + count > data.length) |
* || offset + count > data.length) |
1474 |
* (while unspecified, this is a StringIndexOutOfBoundsException) |
* (while unspecified, this is a StringIndexOutOfBoundsException) |
1475 |
* @see #String(char[], int, int) |
* @see #String(char[], int, int) |
1476 |
*/ |
*/ |
1490 |
* @return String containing the chars from data[offset..offset+count] |
* @return String containing the chars from data[offset..offset+count] |
1491 |
* @throws NullPointerException if data is null |
* @throws NullPointerException if data is null |
1492 |
* @throws IndexOutOfBoundsException if (offset < 0 || count < 0 |
* @throws IndexOutOfBoundsException if (offset < 0 || count < 0 |
1493 |
* || offset + count > data.length) |
* || offset + count > data.length) |
1494 |
* (while unspecified, this is a StringIndexOutOfBoundsException) |
* (while unspecified, this is a StringIndexOutOfBoundsException) |
1495 |
* @see #String(char[], int, int) |
* @see #String(char[], int, int) |
1496 |
*/ |
*/ |
1511 |
*/ |
*/ |
1512 |
public static String copyValueOf(char[] data) |
public static String copyValueOf(char[] data) |
1513 |
{ |
{ |
1514 |
return new String(data, 0, data.length, false); |
return copyValueOf (data, 0, data.length); |
1515 |
} |
} |
1516 |
|
|
1517 |
/** |
/** |
1671 |
|
|
1672 |
return value; |
return value; |
1673 |
} |
} |
1674 |
} // class String |
} |