aboutsummaryrefslogtreecommitdiff
path: root/libjava/java
diff options
context:
space:
mode:
authorMichael Koch <konqueror@gmx.de>2004-11-17 11:57:55 +0000
committerMichael Koch <mkoch@gcc.gnu.org>2004-11-17 11:57:55 +0000
commit4dbbd945e0b1eac353b14d9eb2dfecde771e4910 (patch)
tree41961278c02922d45da1f6d5d4aac0d2cff26883 /libjava/java
parent39850c0b2ebea496afe282431e1c4c351416a2bc (diff)
downloadgcc-4dbbd945e0b1eac353b14d9eb2dfecde771e4910.zip
gcc-4dbbd945e0b1eac353b14d9eb2dfecde771e4910.tar.gz
gcc-4dbbd945e0b1eac353b14d9eb2dfecde771e4910.tar.bz2
2004-11-17 Michael Koch <konqueror@gmx.de>
* java/nio/DirectByteBufferImpl.java (owner): Updated comment. (allocate): New method. From-SVN: r90804
Diffstat (limited to 'libjava/java')
-rw-r--r--libjava/java/nio/DirectByteBufferImpl.java10
1 files changed, 9 insertions, 1 deletions
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);