0N/A/*
2362N/A * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
2362N/A * published by the Free Software Foundation. Oracle designates this
0N/A * particular file as subject to the "Classpath" exception as provided
2362N/A * by Oracle in the LICENSE file that accompanied this code.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A * or visit www.oracle.com if you need additional information or have any
2362N/A * questions.
0N/A */
0N/A
0N/Apackage java.lang;
0N/A
0N/A
0N/A/**
0N/A * A <tt>CharSequence</tt> is a readable sequence of <code>char</code> values. This
0N/A * interface provides uniform, read-only access to many different kinds of
0N/A * <code>char</code> sequences.
0N/A * A <code>char</code> value represents a character in the <i>Basic
0N/A * Multilingual Plane (BMP)</i> or a surrogate. Refer to <a
0N/A * href="Character.html#unicode">Unicode Character Representation</a> for details.
0N/A *
0N/A * <p> This interface does not refine the general contracts of the {@link
0N/A * java.lang.Object#equals(java.lang.Object) equals} and {@link
0N/A * java.lang.Object#hashCode() hashCode} methods. The result of comparing two
0N/A * objects that implement <tt>CharSequence</tt> is therefore, in general,
0N/A * undefined. Each object may be implemented by a different class, and there
0N/A * is no guarantee that each class will be capable of testing its instances
0N/A * for equality with those of the other. It is therefore inappropriate to use
0N/A * arbitrary <tt>CharSequence</tt> instances as elements in a set or as keys in
0N/A * a map. </p>
0N/A *
0N/A * @author Mike McCloskey
0N/A * @since 1.4
0N/A * @spec JSR-51
0N/A */
0N/A
0N/Apublic interface CharSequence {
0N/A
0N/A /**
0N/A * Returns the length of this character sequence. The length is the number
0N/A * of 16-bit <code>char</code>s in the sequence.</p>
0N/A *
0N/A * @return the number of <code>char</code>s in this sequence
0N/A */
0N/A int length();
0N/A
0N/A /**
0N/A * Returns the <code>char</code> value at the specified index. An index ranges from zero
0N/A * to <tt>length() - 1</tt>. The first <code>char</code> value of the sequence is at
0N/A * index zero, the next at index one, and so on, as for array
0N/A * indexing. </p>
0N/A *
0N/A * <p>If the <code>char</code> value specified by the index is a
3856N/A * <a href="{@docRoot}/java/lang/Character.html#unicode">surrogate</a>, the surrogate
0N/A * value is returned.
0N/A *
0N/A * @param index the index of the <code>char</code> value to be returned
0N/A *
0N/A * @return the specified <code>char</code> value
0N/A *
0N/A * @throws IndexOutOfBoundsException
0N/A * if the <tt>index</tt> argument is negative or not less than
0N/A * <tt>length()</tt>
0N/A */
0N/A char charAt(int index);
0N/A
0N/A /**
0N/A * Returns a new <code>CharSequence</code> that is a subsequence of this sequence.
0N/A * The subsequence starts with the <code>char</code> value at the specified index and
0N/A * ends with the <code>char</code> value at index <tt>end - 1</tt>. The length
0N/A * (in <code>char</code>s) of the
0N/A * returned sequence is <tt>end - start</tt>, so if <tt>start == end</tt>
0N/A * then an empty sequence is returned. </p>
0N/A *
0N/A * @param start the start index, inclusive
0N/A * @param end the end index, exclusive
0N/A *
0N/A * @return the specified subsequence
0N/A *
0N/A * @throws IndexOutOfBoundsException
0N/A * if <tt>start</tt> or <tt>end</tt> are negative,
0N/A * if <tt>end</tt> is greater than <tt>length()</tt>,
0N/A * or if <tt>start</tt> is greater than <tt>end</tt>
0N/A */
0N/A CharSequence subSequence(int start, int end);
0N/A
0N/A /**
0N/A * Returns a string containing the characters in this sequence in the same
0N/A * order as this sequence. The length of the string will be the length of
0N/A * this sequence. </p>
0N/A *
0N/A * @return a string consisting of exactly this sequence of characters
0N/A */
0N/A public String toString();
0N/A
0N/A}