summaryrefslogtreecommitdiffstats
path: root/src/java/com/jogamp/common/nio
diff options
context:
space:
mode:
Diffstat (limited to 'src/java/com/jogamp/common/nio')
-rwxr-xr-xsrc/java/com/jogamp/common/nio/Buffers.java46
1 files changed, 27 insertions, 19 deletions
diff --git a/src/java/com/jogamp/common/nio/Buffers.java b/src/java/com/jogamp/common/nio/Buffers.java
index 4a5255e..283cf07 100755
--- a/src/java/com/jogamp/common/nio/Buffers.java
+++ b/src/java/com/jogamp/common/nio/Buffers.java
@@ -41,6 +41,8 @@ package com.jogamp.common.nio;
import java.nio.*;
+import jogamp.common.os.PlatformPropsImpl;
+
import com.jogamp.common.util.ValueConv;
/**
@@ -359,25 +361,31 @@ public class Buffers {
if (buf == null) {
return true;
}
- if (buf instanceof ByteBuffer) {
- return ((ByteBuffer) buf).isDirect();
- } else if (buf instanceof IntBuffer) {
- return ((IntBuffer) buf).isDirect();
- } else if (buf instanceof ShortBuffer) {
- return ((ShortBuffer) buf).isDirect();
- } else if (buf instanceof FloatBuffer) {
- return ((FloatBuffer) buf).isDirect();
- } else if (buf instanceof DoubleBuffer) {
- return ((DoubleBuffer) buf).isDirect();
- } else if (buf instanceof LongBuffer) {
- return ((LongBuffer) buf).isDirect();
- } else if (buf instanceof CharBuffer) {
- return ((CharBuffer) buf).isDirect();
- } else if (buf instanceof PointerBuffer) {
- return ((PointerBuffer) buf).isDirect();
- } else if (buf instanceof Buffer) {
- throw new IllegalArgumentException("Unexpected buffer type Buffer.isDirect() operation is undefined");
- }
+ if ( PlatformPropsImpl.JAVA_6 ) {
+ if (buf instanceof Buffer) {
+ return ((Buffer) buf).isDirect();
+ } else if (buf instanceof PointerBuffer) {
+ return ((PointerBuffer) buf).isDirect();
+ }
+ } else {
+ if (buf instanceof ByteBuffer) {
+ return ((ByteBuffer) buf).isDirect();
+ } else if (buf instanceof IntBuffer) {
+ return ((IntBuffer) buf).isDirect();
+ } else if (buf instanceof ShortBuffer) {
+ return ((ShortBuffer) buf).isDirect();
+ } else if (buf instanceof FloatBuffer) {
+ return ((FloatBuffer) buf).isDirect();
+ } else if (buf instanceof DoubleBuffer) {
+ return ((DoubleBuffer) buf).isDirect();
+ } else if (buf instanceof LongBuffer) {
+ return ((LongBuffer) buf).isDirect();
+ } else if (buf instanceof CharBuffer) {
+ return ((CharBuffer) buf).isDirect();
+ } else if (buf instanceof PointerBuffer) {
+ return ((PointerBuffer) buf).isDirect();
+ }
+ }
throw new IllegalArgumentException("Unexpected buffer type " + buf.getClass().getName());
}