Commit c363e02d by Michael Koch Committed by Michael Koch

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
parent 2d133a9f
2003-05-10 Michael Koch <konqueror@gmx.de> 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>
* java/security/Identity.java, * java/security/Identity.java,
java/security/IdentityScope.java, java/security/IdentityScope.java,
java/security/Key.java, java/security/Key.java,
......
...@@ -177,7 +177,7 @@ public abstract class CharBuffer extends Buffer ...@@ -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 ...@@ -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 ...@@ -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 ());
} }
/** /**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment