• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  *  Licensed to the Apache Software Foundation (ASF) under one or more
3  *  contributor license agreements.  See the NOTICE file distributed with
4  *  this work for additional information regarding copyright ownership.
5  *  The ASF licenses this file to You under the Apache License, Version 2.0
6  *  (the "License"); you may not use this file except in compliance with
7  *  the License.  You may obtain a copy of the License at
8  *
9  *     http://www.apache.org/licenses/LICENSE-2.0
10  *
11  *  Unless required by applicable law or agreed to in writing, software
12  *  distributed under the License is distributed on an "AS IS" BASIS,
13  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  *  See the License for the specific language governing permissions and
15  *  limitations under the License.
16  */
17 
18 package java.lang;
19 
20 
21 /**
22  * This interface represents an ordered set of characters and defines the
23  * methods to probe them.
24  *
25  * @since Android 1.0
26  */
27 public interface CharSequence {
28 
29     /**
30      * Returns the number of characters in this sequence.
31      *
32      * @return the number of characters.
33      * @since Android 1.0
34      */
length()35     public int length();
36 
37     /**
38      * Returns the character at the specified index, with the first character
39      * having index zero.
40      *
41      * @param index
42      *            the index of the character to return.
43      * @return the requested character.
44      * @throws IndexOutOfBoundsException
45      *             if {@code index < 0} or {@code index} is greater than the
46      *             length of this sequence.
47      * @since Android 1.0
48      */
charAt(int index)49     public char charAt(int index);
50 
51     /**
52      * Returns a {@code CharSequence} from the {@code start} index (inclusive)
53      * to the {@code end} index (exclusive) of this sequence.
54      *
55      * @param start
56      *            the start offset of the sub-sequence. It is inclusive, that
57      *            is, the index of the first character that is included in the
58      *            sub-sequence.
59      * @param end
60      *            the end offset of the sub-sequence. It is exclusive, that is,
61      *            the index of the first character after those that are included
62      *            in the sub-sequence
63      * @return the requested sub-sequence.
64      * @throws IndexOutOfBoundsException
65      *             if {@code start < 0}, {@code end < 0}, {@code start > end},
66      *             or if {@code start} or {@code end} are greater than the
67      *             length of this sequence.
68      * @since Android 1.0
69      */
subSequence(int start, int end)70     public CharSequence subSequence(int start, int end);
71 
72     /**
73      * Returns a string with the same characters in the same order as in this
74      * sequence.
75      *
76      * @return a string based on this sequence.
77      * @since Android 1.0
78      */
toString()79     public String toString();
80 }
81