StringIndexOutOfBoundsException.java 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. /* StringIndexOutOfBoundsException.java -- thrown to indicate attempt to
  2. exceed string bounds
  3. Copyright (C) 1998, 1999, 2001, 2002, 2005 Free Software Foundation, Inc.
  4. This file is part of GNU Classpath.
  5. GNU Classpath is free software; you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation; either version 2, or (at your option)
  8. any later version.
  9. GNU Classpath is distributed in the hope that it will be useful, but
  10. WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with GNU Classpath; see the file COPYING. If not, write to the
  15. Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
  16. 02110-1301 USA.
  17. Linking this library statically or dynamically with other modules is
  18. making a combined work based on this library. Thus, the terms and
  19. conditions of the GNU General Public License cover the whole
  20. combination.
  21. As a special exception, the copyright holders of this library give you
  22. permission to link this library with independent modules to produce an
  23. executable, regardless of the license terms of these independent
  24. modules, and to copy and distribute the resulting executable under
  25. terms of your choice, provided that you also meet, for each linked
  26. independent module, the terms and conditions of the license of that
  27. module. An independent module is a module which is not derived from
  28. or based on this library. If you modify this library, you may extend
  29. this exception to your version of the library, but you are not
  30. obligated to do so. If you do not wish to do so, delete this
  31. exception statement from your version. */
  32. package java.lang;
  33. /**
  34. * This exception can be thrown to indicate an attempt to access an index
  35. * which is out of bounds of a String. Any negative integer, and a positive
  36. * integer greater than or equal to the size of the string, is an index
  37. * which would be out of bounds.
  38. *
  39. * @author Brian Jones
  40. * @author Warren Levy (warrenl@cygnus.com)
  41. * @status updated to 1.4
  42. */
  43. public class StringIndexOutOfBoundsException extends IndexOutOfBoundsException
  44. {
  45. /**
  46. * Compatible with JDK 1.0+.
  47. */
  48. private static final long serialVersionUID = -6762910422159637258L;
  49. /**
  50. * Create an exception without a message.
  51. */
  52. public StringIndexOutOfBoundsException()
  53. {
  54. }
  55. /**
  56. * Create an exception with a message.
  57. *
  58. * @param s the message
  59. */
  60. public StringIndexOutOfBoundsException(String s)
  61. {
  62. super(s);
  63. }
  64. /**
  65. * Create an exception noting the illegal index.
  66. *
  67. * @param index the invalid index
  68. */
  69. public StringIndexOutOfBoundsException(int index)
  70. {
  71. super("String index out of range: " + index);
  72. }
  73. }