com.jniwrapper.win32
Class WinFunctionCache

java.lang.Object
  |
  +--com.jniwrapper.util.FunctionCache
        |
        +--com.jniwrapper.win32.WinFunctionCache
Direct Known Subclasses:
Kernel32

public class WinFunctionCache
extends FunctionCache

This class provides functionality for seleting appropriate function instance between ANSI and Unicode analogues available in Win32 API depending on the configuration of the cache.

In addition this class is a factory for string parameters, which are created also accordingly to whether Unicode or ANSI functions should be used.


Constructor Summary
WinFunctionCache(Library library)
           
WinFunctionCache(java.lang.String libraryName)
           
 
Method Summary
 Function getFunction(java.lang.String[] functionNames)
          Deprecated. Use FunctionName class instead.
 boolean isUnicode()
           
 void setUnicode(boolean unicode)
          Instructs the cache use Unicode or ANSI functions and parameter types.
 ZeroTerminatedString stringParam()
          Factory method for creating encoding-dependent blank string parameter instance.
 ZeroTerminatedString stringParam(java.lang.String s)
          Factory method for creating encoding-dependent string parameter instance.
 ZeroTerminatedString stringParam(java.lang.String s, int maxLen)
          Factory method for creating encoding-dependent string parameter instance with restricted length.
 ZeroTerminatedString stringParam(ZeroTerminatedString s)
          Factory method for creating encoding-dependent string parameter instance.
 
Methods inherited from class com.jniwrapper.util.FunctionCache
getFunction
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WinFunctionCache

public WinFunctionCache(java.lang.String libraryName)

WinFunctionCache

public WinFunctionCache(Library library)
Method Detail

getFunction

public Function getFunction(java.lang.String[] functionNames)
Deprecated. Use FunctionName class instead.

Selects a name of a function depending on whether Unicode is used or not and returns corresponding function instance.

Parameters:
functionNames - a pair of non-Unicode and Unicode function names. ANSI function name should be the 1st entry in the passed array.
Returns:
Function instance
Throws:
java.lang.IllegalArgumentException - if the passed array's lenght is not equal 2.

isUnicode

public boolean isUnicode()

setUnicode

public void setUnicode(boolean unicode)
Instructs the cache use Unicode or ANSI functions and parameter types.

Parameters:
unicode - if true Unicode names and types will be used, otherwise ANSI.

stringParam

public ZeroTerminatedString stringParam()
Factory method for creating encoding-dependent blank string parameter instance.

Returns:
an instance of empty string of class WideString for Unicode, and AnsiString for ANSI mode.

stringParam

public ZeroTerminatedString stringParam(java.lang.String s)
Factory method for creating encoding-dependent string parameter instance.

Parameters:
s - initial string value.
Returns:
an initialized string of class WideString for Unicode, and AnsiString for ANSI mode.

stringParam

public ZeroTerminatedString stringParam(java.lang.String s,
                                        int maxLen)
Factory method for creating encoding-dependent string parameter instance with restricted length.

Parameters:
s - initial string value.
maxLen - maximum length allowed for the string.
Returns:
an initialized string of class WideString for Unicode, and AnsiString for ANSI mode.

stringParam

public ZeroTerminatedString stringParam(ZeroTerminatedString s)
Factory method for creating encoding-dependent string parameter instance.

Parameters:
s - initial string value.
Returns:
an initialized string of class WideString for Unicode, and AnsiString for ANSI mode.