com.jniwrapper
Class PlatformContext

java.lang.Object
  extended by com.jniwrapper.PlatformContext

public final class PlatformContext
extends java.lang.Object

Provides information on platform-dependent type sizes, etc.


Method Summary
static double convertCDoubleToDouble(byte[] arr)
          Converts a native byte representation of a double precision floating-point value to a double.
static double convertCFloatToDouble(byte[] arr)
          Converts a native byte representation of a single precision floating-point value to a double.
static double convertCLongDoubleToDouble(byte[] arr)
          Converts a native byte representation of a long double precision floating-point value to a double.
static byte[] convertDoubleToCDouble(double d)
          Converts a double precision floating-point value to platform native byte representation.
static byte[] convertDoubleToCFloat(double f)
          Converts a single precision floating-point value to platform native byte representation.
static byte[] convertDoubleToCLongDouble(double d)
          Converts a double precision floating-point value to platform native byte representation of long double type.
static int getAlignedParameterLength(int paramLen)
          Returns the length of the aligned parameter on the stack.
static int getAlignedParameterLength(Parameter p)
          Returns the length of the aligned parameter on the stack.
static int getAlignedPointerLength()
          Returns the length of the aligned pointer on the stack.
static int getBoolLength()
          Returns a bool type length (sizeof(bool)).
static int getCharLength()
          Returns a character length (sizeof(char)).
static byte getDefaultCallingConvention()
          Returns platform default calling conventions for libraries.
static short getDefaultStructureAlignment()
          Returns platform required structure alignment.
static int getDoubleLength()
          Returns a double precision floating-point value length (sizeof(double)).
static int getFloatLength()
          Returns a single precision floating-point value length (sizeof(float)).
static int getIntLength()
          Returns an integer length (sizeof(int)).
static int getLongDoubleLength()
          Returns a long double precision floating-point value length (sizeof(long double)).
static int getLongLength()
          Returns a long integer length (sizeof(long)).
static short getParameterAlignment()
          Returns platform default parameter alignment for function calls.
static int getPointerLength()
          Returns a pointer length (sizeof(void*)).
static int getShortLength()
          Returns a short integer length (sizeof(short)).
static int getWideCharLength()
          Returns a wide character length (sizeof(wchar_t)).
static boolean isAIX()
           
static boolean isLeopard()
           
static boolean isLinux()
           
static boolean isLion()
           
static boolean isLittleEndian()
          Returns true if the underlying platform byte order is little endian, that is it stores the least significant byte of a value first.
static boolean isMacNewerThanTigerButOlderThanMavericks()
           
static boolean isMacOS()
           
static boolean isMountainLion()
           
static boolean isPPC()
           
static boolean isPPC64()
           
static boolean isSnowLeopard()
           
static boolean isSparc()
           
static boolean isSparc64()
           
static boolean isSunOS()
           
static boolean isTiger()
           
static boolean isUnicode()
           
static boolean isWindows()
           
static boolean isX32()
           
static boolean isX64()
           
static int strlen(long ptrToString)
           
static int wcslen(long ptrToWideString)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

isWindows

public static boolean isWindows()

isLinux

public static boolean isLinux()

isMacOS

public static boolean isMacOS()

isSunOS

public static boolean isSunOS()

isAIX

public static boolean isAIX()

isX32

public static boolean isX32()

isX64

public static boolean isX64()

isPPC

public static boolean isPPC()

isPPC64

public static boolean isPPC64()

isSparc

public static boolean isSparc()

isSparc64

public static boolean isSparc64()

getCharLength

public static int getCharLength()
Returns a character length (sizeof(char)).


getWideCharLength

public static int getWideCharLength()
Returns a wide character length (sizeof(wchar_t)).


getBoolLength

public static int getBoolLength()
Returns a bool type length (sizeof(bool)).


getPointerLength

public static int getPointerLength()
Returns a pointer length (sizeof(void*)).


getShortLength

public static int getShortLength()
Returns a short integer length (sizeof(short)).


getIntLength

public static int getIntLength()
Returns an integer length (sizeof(int)).


getLongLength

public static int getLongLength()
Returns a long integer length (sizeof(long)).


getFloatLength

public static int getFloatLength()
Returns a single precision floating-point value length (sizeof(float)).


getDoubleLength

public static int getDoubleLength()
Returns a double precision floating-point value length (sizeof(double)).


getLongDoubleLength

public static int getLongDoubleLength()
Returns a long double precision floating-point value length (sizeof(long double)). On certain platforms long double can be the same as double.


isLittleEndian

public static boolean isLittleEndian()
Returns true if the underlying platform byte order is little endian, that is it stores the least significant byte of a value first.


getParameterAlignment

public static short getParameterAlignment()
Returns platform default parameter alignment for function calls.


getDefaultStructureAlignment

public static short getDefaultStructureAlignment()
Returns platform required structure alignment. If alignment is not required, returns 1 meaning no alignment is necessary. Some libraries may be compiled with a different structure alignment.


getDefaultCallingConvention

public static byte getDefaultCallingConvention()
Returns platform default calling conventions for libraries.


convertDoubleToCFloat

public static byte[] convertDoubleToCFloat(double f)
Converts a single precision floating-point value to platform native byte representation.


convertCFloatToDouble

public static double convertCFloatToDouble(byte[] arr)
Converts a native byte representation of a single precision floating-point value to a double.


convertDoubleToCDouble

public static byte[] convertDoubleToCDouble(double d)
Converts a double precision floating-point value to platform native byte representation.


convertCDoubleToDouble

public static double convertCDoubleToDouble(byte[] arr)
Converts a native byte representation of a double precision floating-point value to a double.


convertDoubleToCLongDouble

public static byte[] convertDoubleToCLongDouble(double d)
Converts a double precision floating-point value to platform native byte representation of long double type.


convertCLongDoubleToDouble

public static double convertCLongDoubleToDouble(byte[] arr)
Converts a native byte representation of a long double precision floating-point value to a double. This conversion may lead to value loss if java double does not have enough precision.


strlen

public static int strlen(long ptrToString)

wcslen

public static int wcslen(long ptrToWideString)

isUnicode

public static boolean isUnicode()

getAlignedPointerLength

public static int getAlignedPointerLength()
Returns the length of the aligned pointer on the stack.


getAlignedParameterLength

public static int getAlignedParameterLength(int paramLen)
Returns the length of the aligned parameter on the stack.

Parameters:
paramLen - unaligned length of the parameter.

getAlignedParameterLength

public static int getAlignedParameterLength(Parameter p)
Returns the length of the aligned parameter on the stack.

Parameters:
p - the parameter.

isTiger

public static boolean isTiger()

isLeopard

public static boolean isLeopard()

isSnowLeopard

public static boolean isSnowLeopard()

isLion

public static boolean isLion()

isMountainLion

public static boolean isMountainLion()

isMacNewerThanTigerButOlderThanMavericks

public static boolean isMacNewerThanTigerButOlderThanMavericks()