1/*
2 * Copyright (C) 2014 The Android Open Source Project
3 * Copyright (c) 1994, 2008, Oracle and/or its affiliates. All rights reserved.
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 *
6 * This code is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License version 2 only, as
8 * published by the Free Software Foundation.  Oracle designates this
9 * particular file as subject to the "Classpath" exception as provided
10 * by Oracle in the LICENSE file that accompanied this code.
11 *
12 * This code is distributed in the hope that it will be useful, but WITHOUT
13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
15 * version 2 for more details (a copy is included in the LICENSE file that
16 * accompanied this code).
17 *
18 * You should have received a copy of the GNU General Public License version
19 * 2 along with this work; if not, write to the Free Software Foundation,
20 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
21 *
22 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
23 * or visit www.oracle.com if you need additional information or have any
24 * questions.
25 */
26
27package java.lang;
28
29/**
30 * Thrown to indicate that an array has been accessed with an
31 * illegal index. The index is either negative or greater than or
32 * equal to the size of the array.
33 *
34 * @author  unascribed
35 * @since   JDK1.0
36 */
37public
38class ArrayIndexOutOfBoundsException extends IndexOutOfBoundsException {
39    private static final long serialVersionUID = -5116101128118950844L;
40
41    /**
42     * Constructs an <code>ArrayIndexOutOfBoundsException</code> with no
43     * detail message.
44     */
45    public ArrayIndexOutOfBoundsException() {
46        super();
47    }
48
49    /**
50     * Constructs a new <code>ArrayIndexOutOfBoundsException</code>
51     * class with an argument indicating the illegal index.
52     *
53     * @param   index   the illegal index.
54     */
55    public ArrayIndexOutOfBoundsException(int index) {
56        super("Array index out of range: " + index);
57    }
58
59    /**
60     * Constructs an <code>ArrayIndexOutOfBoundsException</code> class
61     * with the specified detail message.
62     *
63     * @param   s   the detail message.
64     */
65    public ArrayIndexOutOfBoundsException(String s) {
66        super(s);
67    }
68
69    /**
70     * Used internally for consistent high-quality error reporting.
71     * @hide
72     */
73    public ArrayIndexOutOfBoundsException(int sourceLength, int index) {
74        super("length=" + sourceLength + "; index=" + index);
75    }
76
77    /**
78     * Used internally for consistent high-quality error reporting.
79     * @hide
80     */
81    public ArrayIndexOutOfBoundsException(int sourceLength, int offset,
82            int count) {
83        super("length=" + sourceLength + "; regionStart=" + offset
84                + "; regionLength=" + count);
85    }
86}
87