This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
Re: [PATCH] java.nio.channels
Am Mittwoch, 13. November 2002 19:14 schrieb Tom Tromey:
> Michael> Hmm, I tried it here in a clean tree. All compiled fine.
> What Michael> errors do you get ?
>
> Sorry, I should have sent that the first time.
>
> make[1]: Entering directory
> `/home/tromey/gnu/trunk-gcc/build/i686-pc-linux-gnu/libjava'
> /home/tromey/gnu/trunk-gcc/build/gcc/gcj
> -B/home/tromey/gnu/trunk-gcc/build/i686-pc-linux-gnu/libjava/
> -B/home/tromey/gnu/trunk-gcc/build/gcc/ --encoding=UTF-8 -C -g
> -classpath '' -bootclasspath
> /home/tromey/gnu/trunk-gcc/build/i686-pc-linux-gnu/libjava:../../..
>/gcc/libjava \ -d
> /home/tromey/gnu/trunk-gcc/build/i686-pc-linux-gnu/libjava
> ../../../gcc/libjava/gnu/java/nio/charset/ISO_8859_1.java
> ./../../gcc/libjava/gnu/java/nio/charset/ISO_8859_1.java: In class
> `gnu.java.nio.charset.ISO_8859_1$Encoder':
> ./../../gcc/libjava/gnu/java/nio/charset/ISO_8859_1.java: In method
> `gnu.java.nio.charset.ISO_8859_1$Encoder.encodeLoop(java.nio.CharBu
>ffer,java.nio.ByteBuffer)':
> ./../../gcc/libjava/gnu/java/nio/charset/ISO_8859_1.java:126:
> error: Can't find method `put(B)' in type `java.nio.ByteBuffer'.
> out.put ((byte) c);
> ^
> ./../../gcc/libjava/gnu/java/nio/charset/ISO_8859_1.java: In class
> `gnu.java.nio.charset.ISO_8859_1$Decoder':
> ./../../gcc/libjava/gnu/java/nio/charset/ISO_8859_1.java: In method
> `gnu.java.nio.charset.ISO_8859_1$Decoder.decodeLoop(java.nio.ByteBu
>ffer,java.nio.CharBuffer)':
> ./../../gcc/libjava/gnu/java/nio/charset/ISO_8859_1.java:86: error:
> Can't find method `get()' in type `java.nio.ByteBuffer'. byte b =
> in.get ();
> ^
> 2 errors
>
>
> Sure enough, ByteBuffer has nothing in it.
> Copying it over yields errors about other *Buffer classes.
> I didn't want to pursue it any further...
Thanks, I commited the attached fast fix.
Michael
--
Homepage: http://www.worldforge.org/
GPG-key: http://konqueror.dyndns.org/~mkoch/michael.gpg
? new
Index: ChangeLog
===================================================================
RCS file: /cvs/gcc/gcc/libjava/ChangeLog,v
retrieving revision 1.1530
diff -b -u -r1.1530 ChangeLog
--- ChangeLog 13 Nov 2002 13:52:46 -0000 1.1530
+++ ChangeLog 13 Nov 2002 18:42:01 -0000
@@ -1,5 +1,13 @@
2002-11-13 Michael Koch <konqueror@gmx.de>
+ * java/nio/ByteBuffer.java
+ (allocate): New method.
+ (wrap): New method.
+ (put): New method.
+ (get): New method.
+
+2002-11-13 Michael Koch <konqueror@gmx.de>
+
* java/nio/channels/AlreadyConnectedException.java:
Removed unneeded import.
(AlreadyConnectedException): Documentation added.
Index: java/nio/ByteBuffer.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/nio/ByteBuffer.java,v
retrieving revision 1.2
diff -b -u -r1.2 ByteBuffer.java
--- java/nio/ByteBuffer.java 7 Oct 2002 13:39:22 -0000 1.2
+++ java/nio/ByteBuffer.java 13 Nov 2002 18:42:02 -0000
@@ -39,4 +39,41 @@
public abstract class ByteBuffer extends Buffer
{
+ public static ByteBuffer allocate (int capacity)
+ {
+ return null;
+ }
+
+ final public static ByteBuffer wrap (byte[] array, int offset, int length)
+ {
+ return null;
+ }
+
+ final public static ByteBuffer wrap (byte[] array)
+ {
+ return wrap (array, 0, array.length);
+ }
+
+ final public ByteBuffer put (ByteBuffer src)
+ {
+ while (src.hasRemaining ())
+ put (src.get ());
+
+ return this;
+ }
+
+ final public ByteBuffer put (byte[] src, int offset, int length)
+ {
+ for (int i = offset; i < offset + length; i++)
+ put (src [i]);
+ return this;
+ }
+ public final ByteBuffer put (byte[] src)
+ {
+ return put (src, 0, src.length);
+ }
+
+ public abstract byte get ();
+
+ public abstract ByteBuffer put (byte b);
}