diff options
Diffstat (limited to 'src/java/com/jogamp/common')
-rwxr-xr-x | src/java/com/jogamp/common/nio/Buffers.java | 46 | ||||
-rw-r--r-- | src/java/com/jogamp/common/os/Platform.java | 15 | ||||
-rw-r--r-- | src/java/com/jogamp/common/util/VersionUtil.java | 3 |
3 files changed, 43 insertions, 21 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()); } diff --git a/src/java/com/jogamp/common/os/Platform.java b/src/java/com/jogamp/common/os/Platform.java index 72a0b3d..e58e72c 100644 --- a/src/java/com/jogamp/common/os/Platform.java +++ b/src/java/com/jogamp/common/os/Platform.java @@ -257,13 +257,26 @@ public class Platform extends PlatformPropsImpl { public static void initSingleton() { } /** - * Returns true only if this program is running on the Java Standard Edition. + * Returns true only if having {@link java.nio.LongBuffer} and {@link java.nio.DoubleBuffer} available. */ public static boolean isJavaSE() { return JAVA_SE; } /** + * Returns true only if being compatible w/ language level 6, e.g. JRE 1.6. + * <p> + * Implies {@link #isJavaSE()}. + * </p> + * <p> + * <i>Note</i>: We claim Android is compatible. + * </p> + */ + public static boolean isJava6() { + return JAVA_6; + } + + /** * Returns true if this machine is little endian, otherwise false. */ public static boolean isLittleEndian() { diff --git a/src/java/com/jogamp/common/util/VersionUtil.java b/src/java/com/jogamp/common/util/VersionUtil.java index e5491c7..22672b4 100644 --- a/src/java/com/jogamp/common/util/VersionUtil.java +++ b/src/java/com/jogamp/common/util/VersionUtil.java @@ -71,7 +71,8 @@ public class VersionUtil { sb.append("Platform: Java Version: ").append(Platform.getJavaVersion()).append(", VM: ").append(Platform.getJavaVMName()); sb.append(", Runtime: ").append(Platform.getJavaRuntimeName()).append(Platform.getNewline()); sb.append("Platform: Java Vendor: ").append(Platform.getJavaVendor()).append(", ").append(Platform.getJavaVendorURL()); - sb.append(", is JavaSE: ").append(Platform.isJavaSE()); + sb.append(", JavaSE: ").append(Platform.isJavaSE()); + sb.append(", Java6: ").append(Platform.isJava6()); sb.append(", AWT enabled: ").append(Platform.AWT_AVAILABLE); sb.append(Platform.getNewline()).append(SEPERATOR); |