2004-11-17 Michael Koch <konqueror@gmx.de>
authorMichael Koch <konqueror@gmx.de>
Wed, 17 Nov 2004 11:57:55 +0000 (11:57 +0000)
committerMichael Koch <mkoch@gcc.gnu.org>
Wed, 17 Nov 2004 11:57:55 +0000 (11:57 +0000)
*  java/nio/DirectByteBufferImpl.java
(owner): Updated comment.
(allocate): New method.

From-SVN: r90804

libjava/ChangeLog
libjava/java/nio/DirectByteBufferImpl.java

index d950e93ecf9c3e5ba60bc4f9c3f8a870480c2ea9..c39097bc50302dcaedf413578de02c0ec22d2a72 100644 (file)
@@ -1,3 +1,9 @@
+2004-11-17  Michael Koch  <konqueror@gmx.de>
+
+       *  java/nio/DirectByteBufferImpl.java
+       (owner): Updated comment.
+       (allocate): New method.
+
 2004-11-17  Michael Koch  <konqueror@gmx.de>
 
        * java/net/URL.java (URL): Handle case when argument is null.
index aad5dca1e5da61c8de596fd91b1a9d8a5c5861fd..89be156d43220c708b9ac72e0f8d84c686fb839a 100644 (file)
@@ -52,7 +52,7 @@ final class DirectByteBufferImpl extends ByteBuffer
       }
   }
   
-  /** 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 @@ final class DirectByteBufferImpl extends ByteBuffer
     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);