diff --git a/base/source/c/compile_windows_i386.mak b/base/source/c/compile_windows_i386.mak index 43a643077481501aad879e424d26f1c2a4ccaf54..358d8889872bfc7a4e595468cf719adbef5b9986 100644 --- a/base/source/c/compile_windows_i386.mak +++ b/base/source/c/compile_windows_i386.mak @@ -9,7 +9,7 @@ VCPPDIR=C:\Program Files\Microsoft Visual Studio 8\VC # Directory where JDK is installed (We require JDK 1.5 or above), for example -JAVADIR=C:\Program Files\Java\jdk1.5.0_15 +JAVADIR=C:\Program Files\Java\jdk1.5.0_22 # Common parent directory PARENTDIR=C:\nativeData diff --git a/base/source/c/compile_windows_x64.mak b/base/source/c/compile_windows_x64.mak index aebd972d566f7ff0bed824d1ce5f3cb2a70cf70e..111b06c1493acf84d0da2f30781a6821dc6d3f60 100644 --- a/base/source/c/compile_windows_x64.mak +++ b/base/source/c/compile_windows_x64.mak @@ -6,10 +6,10 @@ #============================================================================ # Visual C++ directory, for example -VCPPDIR=C:\Program Files\Microsoft Visual Studio 8\VC +VCPPDIR=C:\Program Files (x86)\Microsoft Visual Studio 8\VC # Directory where JDK is installed (We require JDK 1.5 or above), for example -JAVADIR=C:\Program Files\Java\jdk1.5.0_15 +JAVADIR=C:\Program Files\Java\jdk1.5.0_22 # Common parent directory PARENTDIR=C:\nativeData diff --git a/base/source/c/copyCommon.c b/base/source/c/copyCommon.c index 64fa05a76ee8dc7e6f01fd6a0074fe6adc2c3e16..2c628232e17868e32e0892fffff1716448f25074 100755 --- a/base/source/c/copyCommon.c +++ b/base/source/c/copyCommon.c @@ -20,6 +20,17 @@ extern "C" { #include <stdio.h> #include "jni.h" +/* + * public static native boolean isLittleEndian(); + */ +JNIEXPORT jboolean JNICALL Java_ch_systemsx_cisd_base_convert_NativeData_isLittleEndian +(JNIEnv *env, + jclass clss + ) +{ + return MACHINE_BYTE_ORDER == 1; +} + /* * A fatal error in a JNI call * Create and throw an 'InternalError' diff --git a/base/source/java/ch/systemsx/cisd/base/convert/NativeData.java b/base/source/java/ch/systemsx/cisd/base/convert/NativeData.java index bfe67feffb8cc99fb5557ca98601af2c00180c8e..751f7f025c218feb731b46d7b881dd0239421b7e 100644 --- a/base/source/java/ch/systemsx/cisd/base/convert/NativeData.java +++ b/base/source/java/ch/systemsx/cisd/base/convert/NativeData.java @@ -66,6 +66,12 @@ public class NativeData BIG_ENDIAN, } + /** + * Returns <code>true</code> if this platform is a little-endian platform and <code>false</code> + * , if it is a big-endian platform. + */ + static native boolean isLittleEndian(); + /** * Copies a range from an array of <code>int</code> into an array of <code>byte</code>. * @@ -234,6 +240,14 @@ public class NativeData public static void ensureNativeLibIsLoaded() { } + + /** + * Returns the native byte order of the host running this JRE. + */ + public static ByteOrder getNativeByteOrder() + { + return isLittleEndian() ? ByteOrder.LITTLE_ENDIAN : ByteOrder.BIG_ENDIAN; + } /** * Converts a <code>byte[]</code> array into a <code>short[]</code> array.