aboutsummaryrefslogtreecommitdiff
path: root/libjava/java/lang/String.java
diff options
context:
space:
mode:
authorMark Wielaard <mark@klomp.org>2001-10-02 20:59:31 +0000
committerMark Wielaard <mark@gcc.gnu.org>2001-10-02 20:59:31 +0000
commit627a8b878ea53819c9ddacdcaa091d517689f52d (patch)
tree3ef0582a181a049f71a29b6428f4483b678b7089 /libjava/java/lang/String.java
parentda5c0f6ef50f0a1a511191c9e2052bd63aee12c4 (diff)
downloadgcc-627a8b878ea53819c9ddacdcaa091d517689f52d.zip
gcc-627a8b878ea53819c9ddacdcaa091d517689f52d.tar.gz
gcc-627a8b878ea53819c9ddacdcaa091d517689f52d.tar.bz2
Makefile.am: Add new classes
* Makefile.am: Add new classes (core_java_source_files): CharSequence (ordinary_java_source_files): Authenticator, PasswordAuthentication * Makefile.in: regenerate * gcj/javaprims.h: ditto * java/lang/CharSequence: new class from Classpath * java/lang/String.java: implements CharSequence (subSequence (int,int)): new method * java/lang/SubString.java: implements CharSequence (subSequence (int,int)): new method remerge comments with Classpath * java/net/Authenticator.java: new class from Classpath * java/net/PasswordAuthentication.java: ditto From-SVN: r45969
Diffstat (limited to 'libjava/java/lang/String.java')
-rw-r--r--libjava/java/lang/String.java24
1 files changed, 23 insertions, 1 deletions
diff --git a/libjava/java/lang/String.java b/libjava/java/lang/String.java
index bed3171..8dadfb5 100644
--- a/libjava/java/lang/String.java
+++ b/libjava/java/lang/String.java
@@ -22,7 +22,7 @@ import java.util.Locale;
* Status: Complete to 1.3.
*/
-public final class String implements Serializable, Comparable
+public final class String implements Serializable, Comparable, CharSequence
{
private Object data;
private int boffset; // Note this is a byte offset - don't use in Java code!
@@ -297,6 +297,28 @@ public final class String implements Serializable, Comparable
}
}
+ /**
+ * Creates a substring of this String, starting at a specified index
+ * and ending at one character before a specified index.
+ * <p>
+ * To implement <code>CharSequence</code>.
+ * Calls <code>substring(beginIndex, endIndex)</code>.
+ *
+ * @param beginIndex index to start substring (base 0)
+ * @param endIndex index after the last character to be
+ * copied into the substring
+ *
+ * @return new String which is a substring of this String
+ *
+ * @exception StringIndexOutOfBoundsException
+ * if (beginIndex < 0 || endIndex > this.length() || beginIndex > endIndex)
+ */
+ public CharSequence subSequence(int beginIndex, int endIndex)
+ throws IndexOutOfBoundsException
+ {
+ return substring(beginIndex, endIndex);
+ }
+
public String substring (int beginIndex)
{
return substring (beginIndex, count);