From 627a8b878ea53819c9ddacdcaa091d517689f52d Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Tue, 2 Oct 2001 20:59:31 +0000 Subject: 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 --- libjava/java/lang/String.java | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) (limited to 'libjava/java/lang/String.java') diff --git a/libjava/java/lang/String.java b/libjava/java/lang/String.java index bed3171fb22..8dadfb59cc0 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. + *

+ * To implement CharSequence. + * Calls substring(beginIndex, endIndex). + * + * @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); -- cgit v1.2.3