1 |
/* StringIndexOutOfBoundsException.java -- exception thrown to indicate |
/* StringIndexOutOfBoundsException.java -- thrown to indicate attempt to |
2 |
an attempt to access an index which is out of bounds. |
exceed string bounds |
3 |
Copyright (C) 1998, 1999, 2001 Free Software Foundation, Inc. |
Copyright (C) 1998, 1999, 2001, 2002 Free Software Foundation, Inc. |
4 |
|
|
5 |
This file is part of GNU Classpath. |
This file is part of GNU Classpath. |
6 |
|
|
8 |
it under the terms of the GNU General Public License as published by |
it under the terms of the GNU General Public License as published by |
9 |
the Free Software Foundation; either version 2, or (at your option) |
the Free Software Foundation; either version 2, or (at your option) |
10 |
any later version. |
any later version. |
11 |
|
|
12 |
GNU Classpath is distributed in the hope that it will be useful, but |
GNU Classpath is distributed in the hope that it will be useful, but |
13 |
WITHOUT ANY WARRANTY; without even the implied warranty of |
WITHOUT ANY WARRANTY; without even the implied warranty of |
14 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
39 |
|
|
40 |
package java.lang; |
package java.lang; |
41 |
|
|
|
/* Written using "Java Class Libraries", 2nd edition, ISBN 0-201-31002-3 |
|
|
* "The Java Language Specification", ISBN 0-201-63451-1 |
|
|
* plus online API docs for JDK 1.2 beta from http://www.javasoft.com. |
|
|
* Status: Believed complete and correct. |
|
|
*/ |
|
|
|
|
42 |
/** |
/** |
43 |
* Exceptions may be thrown by one part of a Java program and caught |
* This exception can be thrown to indicate an attempt to access an index |
44 |
* by another in order to deal with exceptional conditions. |
* which is out of bounds of a String. Any negative integer, and a positive |
45 |
* This exception can be thrown to indicate an attempt to access an |
* integer greater than or equal to the size of the string, is an index |
|
* index which is out of bounds. |
|
|
* Any negative integer less than or equal to -1 and positive |
|
|
* integer greater than or equal to the size of the string is an index |
|
46 |
* which would be out of bounds. |
* which would be out of bounds. |
47 |
* |
* |
|
* @since JDK 1.0 |
|
|
* |
|
48 |
* @author Brian Jones |
* @author Brian Jones |
49 |
* @author Warren Levy <warrenl@cygnus.com> |
* @author Warren Levy <warrenl@cygnus.com> |
50 |
* @date September 18, 1998. |
* @status updated to 1.4 |
51 |
*/ |
*/ |
52 |
public class StringIndexOutOfBoundsException extends IndexOutOfBoundsException |
public class StringIndexOutOfBoundsException extends IndexOutOfBoundsException |
53 |
{ |
{ |
54 |
static final long serialVersionUID = -6762910422159637258L; |
/** |
55 |
|
* Compatible with JDK 1.0+. |
56 |
|
*/ |
57 |
|
private static final long serialVersionUID = -6762910422159637258L; |
58 |
|
|
59 |
/** |
/** |
60 |
* Create an exception without a message. |
* Create an exception without a message. |
61 |
*/ |
*/ |
62 |
public StringIndexOutOfBoundsException() |
public StringIndexOutOfBoundsException() |
63 |
{ |
{ |
64 |
super(); |
} |
|
} |
|
65 |
|
|
66 |
/** |
/** |
67 |
* Create an exception with a message. |
* Create an exception with a message. |
68 |
|
* |
69 |
|
* @param s the message |
70 |
*/ |
*/ |
71 |
public StringIndexOutOfBoundsException(String s) |
public StringIndexOutOfBoundsException(String s) |
72 |
{ |
{ |
73 |
super(s); |
super(s); |
74 |
} |
} |
75 |
|
|
76 |
/** |
/** |
77 |
* Create an exception noting the illegal index. |
* Create an exception noting the illegal index. |
78 |
|
* |
79 |
|
* @param index the invalid index |
80 |
*/ |
*/ |
81 |
public StringIndexOutOfBoundsException(int index) |
public StringIndexOutOfBoundsException(int index) |
82 |
{ |
{ |
83 |
super("String index out of range: " + index); |
super("String index out of range: " + index); |
84 |
} |
} |
85 |
} |
} |