From 4dbbd945e0b1eac353b14d9eb2dfecde771e4910 Mon Sep 17 00:00:00 2001
From: Michael Koch <konqueror@gmx.de>
Date: Wed, 17 Nov 2004 11:57:55 +0000
Subject: 2004-11-17  Michael Koch  <konqueror@gmx.de>

	*  java/nio/DirectByteBufferImpl.java
	(owner): Updated comment.
	(allocate): New method.

From-SVN: r90804
---
 libjava/java/nio/DirectByteBufferImpl.java | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

(limited to 'libjava/java/nio/DirectByteBufferImpl.java')

diff --git a/libjava/java/nio/DirectByteBufferImpl.java b/libjava/java/nio/DirectByteBufferImpl.java
index aad5dca..89be156 100644
--- a/libjava/java/nio/DirectByteBufferImpl.java
+++ b/libjava/java/nio/DirectByteBufferImpl.java
@@ -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);
   
-- 
cgit v1.1