/[classpath]/classpath/java/lang/String.java
ViewVC logotype

Diff of /classpath/java/lang/String.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.58.2.13 by tromey, Tue Sep 27 16:46:46 2005 UTC revision 1.58.2.14 by gnu_andrew, Wed Nov 2 21:44:47 2005 UTC
# Line 237  public final class String Line 237  public final class String
237     * @param count the number of characters from data to copy     * @param count the number of characters from data to copy
238     * @throws NullPointerException if data is null     * @throws NullPointerException if data is null
239     * @throws IndexOutOfBoundsException if (offset < 0 || count < 0     * @throws IndexOutOfBoundsException if (offset < 0 || count < 0
240       *         || offset + count < 0 (overflow)
241     *         || offset + count > data.length)     *         || offset + count > data.length)
242     *         (while unspecified, this is a StringIndexOutOfBoundsException)     *         (while unspecified, this is a StringIndexOutOfBoundsException)
243     */     */
# Line 260  public final class String Line 261  public final class String
261     * @param count the number of characters from ascii to copy     * @param count the number of characters from ascii to copy
262     * @throws NullPointerException if ascii is null     * @throws NullPointerException if ascii is null
263     * @throws IndexOutOfBoundsException if (offset < 0 || count < 0     * @throws IndexOutOfBoundsException if (offset < 0 || count < 0
264       *         || offset + count < 0 (overflow)
265     *         || offset + count > ascii.length)     *         || offset + count > ascii.length)
266     *         (while unspecified, this is a StringIndexOutOfBoundsException)     *         (while unspecified, this is a StringIndexOutOfBoundsException)
267     * @see #String(byte[])     * @see #String(byte[])
# Line 271  public final class String Line 273  public final class String
273     */     */
274    public String(byte[] ascii, int hibyte, int offset, int count)    public String(byte[] ascii, int hibyte, int offset, int count)
275    {    {
276      if (offset < 0 || count < 0 || offset + count > ascii.length)      if (offset < 0)
277        throw new StringIndexOutOfBoundsException();        throw new StringIndexOutOfBoundsException("offset: " + offset);
278        if (count < 0)
279          throw new StringIndexOutOfBoundsException("count: " + count);
280        if (offset + count < 0 || offset + count > ascii.length)
281          throw new StringIndexOutOfBoundsException("offset + count: "
282                                                    + (offset + count));
283      value = new char[count];      value = new char[count];
284      this.offset = 0;      this.offset = 0;
285      this.count = count;      this.count = count;
# Line 331  public final class String Line 338  public final class String
338    public String(byte[] data, int offset, int count, String encoding)    public String(byte[] data, int offset, int count, String encoding)
339      throws UnsupportedEncodingException      throws UnsupportedEncodingException
340    {    {
341      if (offset < 0 || count < 0 || offset + count > data.length)      if (offset < 0)
342        throw new StringIndexOutOfBoundsException();        throw new StringIndexOutOfBoundsException("offset: " + offset);
343        if (count < 0)
344          throw new StringIndexOutOfBoundsException("count: " + count);
345        if (offset + count < 0 || offset + count > data.length)
346          throw new StringIndexOutOfBoundsException("offset + count: "
347                                                    + (offset + count));
348      try      try
349        {        {
350          CharsetDecoder csd = Charset.forName(encoding).newDecoder();          CharsetDecoder csd = Charset.forName(encoding).newDecoder();
# Line 406  public final class String Line 418  public final class String
418     */     */
419    public String(byte[] data, int offset, int count)    public String(byte[] data, int offset, int count)
420    {    {
421      if (offset < 0 || count < 0 || offset + count > data.length)      if (offset < 0)
422        throw new StringIndexOutOfBoundsException();        throw new StringIndexOutOfBoundsException("offset: " + offset);
423        if (count < 0)
424          throw new StringIndexOutOfBoundsException("count: " + count);
425        if (offset + count < 0 || offset + count > data.length)
426          throw new StringIndexOutOfBoundsException("offset + count: "
427                                                    + (offset + count));
428      int o, c;      int o, c;
429      char[] v;      char[] v;
430      String encoding;      String encoding;
# Line 516  public final class String Line 533  public final class String
533     */     */
534    String(char[] data, int offset, int count, boolean dont_copy)    String(char[] data, int offset, int count, boolean dont_copy)
535    {    {
536      if (offset < 0 || count < 0 || offset + count > data.length)      if (offset < 0)
537        throw new StringIndexOutOfBoundsException();        throw new StringIndexOutOfBoundsException("offset: " + offset);
538        if (count < 0)
539          throw new StringIndexOutOfBoundsException("count: " + count);
540        if (offset + count < 0 || offset + count > data.length)
541          throw new StringIndexOutOfBoundsException("offset + count: "
542                                                    + (offset + count));
543      if (dont_copy)      if (dont_copy)
544        {        {
545          value = data;          value = data;
# Line 1613  public final class String Line 1635  public final class String
1635     * @return String containing the chars from data[offset..offset+count]     * @return String containing the chars from data[offset..offset+count]
1636     * @throws NullPointerException if data is null     * @throws NullPointerException if data is null
1637     * @throws IndexOutOfBoundsException if (offset &lt; 0 || count &lt; 0     * @throws IndexOutOfBoundsException if (offset &lt; 0 || count &lt; 0
1638       *         || offset + count &lt; 0 (overflow)
1639       *         || offset + count &lt; 0 (overflow)
1640     *         || offset + count &gt; data.length)     *         || offset + count &gt; data.length)
1641     *         (while unspecified, this is a StringIndexOutOfBoundsException)     *         (while unspecified, this is a StringIndexOutOfBoundsException)
1642     * @see #String(char[], int, int)     * @see #String(char[], int, int)

Legend:
Removed from v.1.58.2.13  
changed lines
  Added in v.1.58.2.14

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26