diff options
Diffstat (limited to 'src/java/com/jogamp/common/nio/NativeBuffer.java')
-rw-r--r-- | src/java/com/jogamp/common/nio/NativeBuffer.java | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/src/java/com/jogamp/common/nio/NativeBuffer.java b/src/java/com/jogamp/common/nio/NativeBuffer.java index ad6bb39..666907f 100644 --- a/src/java/com/jogamp/common/nio/NativeBuffer.java +++ b/src/java/com/jogamp/common/nio/NativeBuffer.java @@ -31,16 +31,19 @@ */ package com.jogamp.common.nio; +import java.nio.Buffer; import java.nio.ByteBuffer; /** * Hardware independent container for various kinds of buffers. * - * @author Michael Bien * @author Sven Gothel + * @author Michael Bien */ public interface NativeBuffer<B extends NativeBuffer> { + public int elementSize(); + public int limit(); public int capacity(); @@ -53,16 +56,30 @@ public interface NativeBuffer<B extends NativeBuffer> { public boolean hasRemaining(); + /** + * @return true if this buffer has a primitive backup array, otherwise false + */ public boolean hasArray(); + /** + * @return the array offset of the optional primitive backup array of the buffer if {@link #hasArray()} is true, + * otherwise 0. + */ public int arrayOffset(); - - public ByteBuffer getBuffer(); + + /** + * @return the primitive backup array of the buffer if {@link #hasArray()} is true, + * otherwise it throws {@link java.lang.UnsupportedOperationException}. + * The returned primitive array maybe of type <code>int[]</code> or <code>long[]</code>, etc .. + * @throws UnsupportedOperationException if this object has no backup array + * @see #hasArray() + */ + public Object array() throws UnsupportedOperationException ; + + public Buffer getBuffer(); public boolean isDirect(); - public long[] array(); - public B rewind(); public B put(int index, long value); @@ -74,5 +91,4 @@ public interface NativeBuffer<B extends NativeBuffer> { public long get(); public long get(int idx); - } |