[Patch] java.nio.DirectByteBufferImpl
Michael Koch
konqueror@gmx.de
Wed Nov 17 12:14:00 GMT 2004
Hi list,
I just commited the attached patch to add support for direct buffers.
Michael
2004-11-17 Michael Koch <konqueror@gmx.de>
* java/nio/DirectByteBufferImpl.java
(owner): Updated comment.
(allocate): New method.
-------------- next part --------------
Index: java/nio/DirectByteBufferImpl.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/nio/DirectByteBufferImpl.java,v
retrieving revision 1.11
diff -u -r1.11 DirectByteBufferImpl.java
--- java/nio/DirectByteBufferImpl.java 9 Jul 2004 13:40:28 -0000 1.11
+++ java/nio/DirectByteBufferImpl.java 17 Nov 2004 11:57:28 -0000
@@ -52,7 +52,7 @@
}
}
- /** Used by MappedByteBufferImpl to prevent premature GC. */
+ /** Used by MappedByteBufferImpl and when slicing to prevent premature GC. */
protected Object owner;
RawData address;
@@ -73,6 +73,14 @@
this.owner = owner;
}
+ /**
+ * Allocates a new direct byte buffer.
+ */
+ public static ByteBuffer allocate(int capacity)
+ {
+ return new DirectByteBufferImpl(allocateImpl(capacity), capacity);
+ }
+
private static native RawData allocateImpl (int capacity);
private static native void freeImpl (RawData address);
More information about the Java-patches
mailing list