From 9bb33ef99b56773e1ee7c0d76ffe03139dfaf5bd Mon Sep 17 00:00:00 2001 From: mkoch Date: Wed, 19 Feb 2003 11:47:49 +0000 Subject: 2003-02-19 Michael Koch * gnu/java/nio/ByteBufferImpl.java (ByteBufferImpl): Renamed two variables. * gnu/java/nio/CharBufferImpl.java (CharBufferImpl): Renamed two variables. * gnu/java/nio/DoubleBufferImpl.java (DoubleBufferImpl): Renamed two variables. * gnu/java/nio/FloatBufferImpl.java (FloatBufferImpl): Renamed two variables. * gnu/java/nio/IntBufferImpl.java (IntBufferImpl): Renamed two variables. * gnu/java/nio/LongBufferImpl.java (LongBufferImpl): Renamed two variables. * gnu/java/nio/ShortBufferImpl.java (ShortBufferImpl): Renamed two variables. * java/nio/CharBuffer.java (wrap): Fixed arguments to CharBufferImpl constructor. (hasArray): Only not read-only buffers have backing arrays. (length): Documentation added. (subSequence): Documentation added. * java/nio/DoubleBuffer.java (hasArray): Only not read-only buffers have backing arrays. * java/nio/FloatBuffer.java (hasArray): Only not read-only buffers have backing arrays. * java/nio/IntBuffer.java (hasArray): Only not read-only buffers have backing arrays. * java/nio/LongBuffer.java (hasArray): Only not read-only buffers have backing arrays. * java/nio/ShortBuffer.java (hasArray): Only not read-only buffers have backing arrays. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@63101 138bc75d-0d04-0410-961f-82ee72b054a4 --- libjava/java/nio/CharBuffer.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'libjava/java/nio/CharBuffer.java') diff --git a/libjava/java/nio/CharBuffer.java b/libjava/java/nio/CharBuffer.java index 9d61be90b04..e2996023047 100644 --- a/libjava/java/nio/CharBuffer.java +++ b/libjava/java/nio/CharBuffer.java @@ -63,7 +63,7 @@ public abstract class CharBuffer extends Buffer */ final public static CharBuffer wrap (char[] array, int offset, int length) { - return new CharBufferImpl (array, offset, offset + length); + return new CharBufferImpl (array, offset, length); } /** @@ -205,7 +205,8 @@ public abstract class CharBuffer extends Buffer */ public final boolean hasArray () { - return backing_buffer != null; + return (backing_buffer != null + && ! isReadOnly ()); } /** @@ -359,6 +360,9 @@ public abstract class CharBuffer extends Buffer return new String (array (), position (), length ()); } + /** + * Returns the length of the remaining chars in this buffer. + */ public final int length () { return remaining (); @@ -370,6 +374,9 @@ public abstract class CharBuffer extends Buffer public abstract ByteOrder order (); /** + * Creates a new character buffer that represents the specified subsequence + * of this buffer, relative to the current position. + * * @exception IndexOutOfBoundsException If the preconditions on start and * end do not hold. */ -- cgit v1.2.3