2003-05-10 Michael Koch <konqueror@gmx.de>

* java/nio/CharBuffer.java
	(put): Fixed precondtion check.
	(toString): Make it work without backing array.
	(put): Skip one level of method calling.

From-SVN: r66656
This commit is contained in:
Michael Koch 2003-05-10 07:41:59 +00:00 committed by Michael Koch
parent 2d133a9fd0
commit c363e02d01
2 changed files with 15 additions and 3 deletions

View File

@ -1,3 +1,10 @@
2003-05-10 Michael Koch <konqueror@gmx.de>
* java/nio/CharBuffer.java
(put): Fixed precondtion check.
(toString): Make it work without backing array.
(put): Skip one level of method calling.
2003-05-10 Michael Koch <konqueror@gmx.de> 2003-05-10 Michael Koch <konqueror@gmx.de>
* java/security/Identity.java, * java/security/Identity.java,

View File

@ -177,7 +177,7 @@ public abstract class CharBuffer extends Buffer
if (offset < 0 if (offset < 0
|| offset >= src.length || offset >= src.length
|| length < 0 || length < 0
|| length >= (src.length - offset)) || length > (src.length - offset))
throw new IndexOutOfBoundsException (); throw new IndexOutOfBoundsException ();
// Put nothing into this buffer when not enough space left. // Put nothing into this buffer when not enough space left.
@ -361,7 +361,12 @@ public abstract class CharBuffer extends Buffer
*/ */
public String toString () public String toString ()
{ {
return new String (array (), position (), length ()); if (hasArray ())
return new String (array (), position (), length ());
char[] buf = new char [length ()];
get (buf);
return new String (buf);
} }
/** /**
@ -409,7 +414,7 @@ public abstract class CharBuffer extends Buffer
*/ */
public final CharBuffer put (String str) public final CharBuffer put (String str)
{ {
return put (str, 0, str.length ()); return put (str.toCharArray (), 0, str.length ());
} }
/** /**