classpath
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: java.nio.CharBuffer should implement java.lang.CharSequence


From: Ito Kazumitsu
Subject: Re: java.nio.CharBuffer should implement java.lang.CharSequence
Date: Mon, 25 Nov 2002 08:31:08 +0900
User-agent: SEMI/1.14.3 (Ushinoya) FLIM/1.14.3 (Unebigory ōmae) APEL/10.3 Emacs/20.7 (i386-*-windows98.2222) MULE/4.1 (AOI) Meadow/1.14 (AWSAKA:62)

In message "java.nio.CharBuffer should implement java.lang.CharSequence"
    on 02/11/22, Ito Kazumitsu <address@hidden> writes:

> I would like the following JDK 1.4 features to be added to
> classpath.   Thank you.

Thank you for your efforts on this,  and now java.nio.CharBuffer
works almost correctly fo me.

But, unfortunately, I found a case where position(int) of
java.nio.Buffer throws IllegalArgumentException when a new
CharBufferImpl is being created.  I am using the following patch
to avoid this.

--- gnu/java/nio/CharBufferImpl.java.orig       Sun Nov 24 07:54:29 2002
+++ gnu/java/nio/CharBufferImpl.java    Sun Nov 24 11:06:57 2002
@@ -55,24 +55,24 @@
   {
     this.backing_buffer = new char[cap];
     this.cap = cap;
-    this.position(off);
     this.limit(lim);
+    this.position(off);
   }
   
   public CharBufferImpl(char[] array, int off, int lim)
   {
     this.backing_buffer = array;
     this.cap = array.length;
-    this.position(off);
     this.limit(lim);
+    this.position(off);
   }
   
   public CharBufferImpl (CharBufferImpl copy)
   {
     backing_buffer = copy.backing_buffer;
     ro = copy.ro;
-    position (copy.position ());
     limit (copy.limit());
+    position (copy.position ());
   }
   
   void inc_pos (int a)
bash-2.02$ diff -u java/nio/CharBuffer.java.orig java/nio/CharBuffer.java
--- java/nio/CharBuffer.java.orig       Sun Nov 24 07:55:45 2002
+++ java/nio/CharBuffer.java    Sun Nov 24 10:42:01 2002
@@ -61,7 +61,7 @@
   
   final public static CharBuffer wrap (char[] array, int offset, int length)
   {
-    return new CharBufferImpl (array, offset, length);
+    return new CharBufferImpl (array, offset, offset + length);
   }
 
   final public static CharBuffer wrap (char[] array)






reply via email to

[Prev in Thread] Current Thread [Next in Thread]