[kaffe] CVS kaffe (dalibor): Resynced with GNU Classpath: Fixed arguments, added javadocs to CharBuffer

Kaffe CVS cvs-commits at kaffe.org
Thu May 27 12:41:02 PDT 2004


PatchSet 4790 
Date: 2004/05/27 19:36:38
Author: dalibor
Branch: HEAD
Tag: (none) 
Log:
Resynced with GNU Classpath: Fixed arguments, added javadocs to CharBuffer

2004-05-27  Dalibor Topic  <robilad at kaffe.org>

        * libraries/javalib/java/nio/CharBuffer.java:
        Resynced with GNU Classpath.

        2004-05-27  Michael Koch  <konqueror at gmx.de>

        * java/nio/CharBuffer.java
        (wrap): Fixed arguments, added javadocs.

Members: 
	ChangeLog:1.2359->1.2360 
	libraries/javalib/java/nio/CharBuffer.java:1.9->1.10 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.2359 kaffe/ChangeLog:1.2360
--- kaffe/ChangeLog:1.2359	Thu May 27 19:22:45 2004
+++ kaffe/ChangeLog	Thu May 27 19:36:38 2004
@@ -1,5 +1,15 @@
 2004-05-27  Dalibor Topic  <robilad at kaffe.org>
 
+	* libraries/javalib/java/nio/CharBuffer.java:
+	Resynced with GNU Classpath.
+
+	2004-05-27  Michael Koch  <konqueror at gmx.de>
+
+	* java/nio/CharBuffer.java
+	(wrap): Fixed arguments, added javadocs.
+
+2004-05-27  Dalibor Topic  <robilad at kaffe.org>
+
 	* libraries/javalib/java/nio/Buffer.java:
 	Resynced with GNU Classpath.
 
Index: kaffe/libraries/javalib/java/nio/CharBuffer.java
diff -u kaffe/libraries/javalib/java/nio/CharBuffer.java:1.9 kaffe/libraries/javalib/java/nio/CharBuffer.java:1.10
--- kaffe/libraries/javalib/java/nio/CharBuffer.java:1.9	Mon May 17 15:01:02 2004
+++ kaffe/libraries/javalib/java/nio/CharBuffer.java	Thu May 27 19:36:40 2004
@@ -65,56 +65,75 @@
    * Wraps a <code>char</code> array into a <code>CharBuffer</code>
    * object.
    *
+   * @param array the array to wrap
+   * @param offset the offset of the region in the array to wrap
+   * @param length the length of the region in the array to wrap
+   *
+   * @return a new <code>CharBuffer</code> object
+   * 
    * @exception IndexOutOfBoundsException If the preconditions on the offset
    * and length parameters do not hold
    */
-  final public static CharBuffer wrap (char[] array, int offset, int length)
+  final public static CharBuffer wrap(char[] array, int offset, int length)
   {
-    return new CharBufferImpl (array, 0, array.length, offset + length, offset, -1, false);
+    return new CharBufferImpl(array, 0, array.length, offset + length, offset, -1, false);
   }
   
   /**
    * Wraps a character sequence into a <code>CharBuffer</code> object.
+   *
+   * @param seq the sequence to wrap
+   *
+   * @return a new <code>CharBuffer</code> object
    */
-  final public static CharBuffer wrap (CharSequence a)
+  final public static CharBuffer wrap(CharSequence seq)
   {
-    return wrap (a, 0, a.length ());
+    return wrap(seq, 0, seq.length());
   }
   
   /**
    * Wraps a character sequence into a <code>CharBuffer</code> object.
    * 
+   * @param seq the sequence to wrap
+   * @param start the index of the first character to wrap
+   * @param end the index of the first character not to wrap
+   *
+   * @return a new <code>CharBuffer</code> object
+   * 
    * @exception IndexOutOfBoundsException If the preconditions on the offset
    * and length parameters do not hold
    */
-  final public static CharBuffer wrap (CharSequence a, int offset, int length)
+  final public static CharBuffer wrap(CharSequence seq, int start, int end)
   {
     // FIXME: implement better handling of java.lang.String.
     // Probably share data with String via reflection.
 	  
-    if ((offset < 0)
-        || (offset > a.length ())
-        || (length < 0)
-        || (length > (a.length () - offset)))
-      throw new IndexOutOfBoundsException ();
+    if ((start < 0)
+        || (start > seq.length())
+        || (end < start)
+        || (end > (seq.length() - start)))
+      throw new IndexOutOfBoundsException();
     
-    char [] buffer = new char [a.length ()];
+    int len = end - start;
+    char[] buffer = new char[len];
     
-    for (int i = offset; i < length; i++)
-      {
-        buffer [i] = a.charAt (i);
-      }
+    for (int i = 0; i < len; i++)
+      buffer[i] = seq.charAt(i + start);
     
-    return wrap (buffer, offset, length).asReadOnlyBuffer ();
+    return wrap(buffer, 0, len).asReadOnlyBuffer();
   }
 
   /**
    * Wraps a <code>char</code> array into a <code>CharBuffer</code>
    * object.
+   *
+   * @param array the array to wrap
+   *
+   * @return a new <code>CharBuffer</code> object
    */
-  final public static CharBuffer wrap (char[] array)
+  final public static CharBuffer wrap(char[] array)
   {
-    return wrap (array, 0, array.length);
+    return wrap(array, 0, array.length);
   }
   
   /**




More information about the kaffe mailing list