com.jniwrapper
Class PlatformContext

java.lang.Object
  |
  +--com.jniwrapper.PlatformContext

public final class PlatformContext
extends java.lang.Object

Provides an 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 length of the aligned parameter on the stack.
static int getAlignedParameterLength(Parameter p)
          Returns length of the aligned parameter on the stack.
static int getAlignedPointerLength()
          Returns length of the aligned pointer on the stack.
static int getBoolLength()
          Returns bool type length (sizeof(bool)).
static int getCharLength()
          Returns 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 double precision floating point value length (sizeof(double)).
static int getFloatLength()
          Returns single precision floating point value length (sizeof(float)).
static int getIntLength()
          Returns integer length (sizeof(int)).
static int getLongDoubleLength()
          Returns long double precision floating point value length (sizeof(long double)).
static int getLongLength()
          Returns long integer length (sizeof(long)).
static short getParameterAlignment()
          Returns platform default parameter alignment for function calls.
static int getPointerLength()
          Returns pointer length (sizeof(void*)).
static int getShortLength()
          Returns short integer length (sizeof(short)).
static int getWideCharLength()
          Returns wide character length (sizeof(wchar_t)).
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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getCharLength

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


getWideCharLength

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


getBoolLength

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


getPointerLength

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


getShortLength

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


getIntLength

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


getLongLength

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


getFloatLength

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


getDoubleLength

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


getLongDoubleLength

public static int getLongDoubleLength()
Returns 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 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 a value loss if java double has not enough precision.


getAlignedPointerLength

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


getAlignedParameterLength

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

Parameters:
paramLen - unaligned length of the parameter.

getAlignedParameterLength

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

Parameters:
p - the parameter.