com.eaio.nativecall
Class Win32Verifier

java.lang.Object
  |
  +--com.eaio.nativecall.Win32Verifier
All Implemented Interfaces:
Verifier

public class Win32Verifier
extends Object
implements Verifier

A Verifier for the Windows environment.

Author:
Johann Burkard

Constructor Summary
Win32Verifier()
          Constructor for Win32Verifier.
 
Method Summary
 String getDefaultModule()
          Returns "kernel32".
 Object handleString(String val, String module, String function)
          If the function name ends on 'W' (Windows' Unicode functions), a char array is returned, otherwise a byte array is returned.
 boolean supports()
          Verifies that the System property "os.name" starts with "Windows".
 String verifyFunctionName(String function)
          Throws a NullPointerException if the function name is null or an empty String.
 String verifyModuleName(String module)
          Returns the default module name if the module name is null or an empty String.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Win32Verifier

public Win32Verifier()
Constructor for Win32Verifier. Does nothing.

Method Detail

supports

public boolean supports()
                 throws SecurityException
Verifies that the System property "os.name" starts with "Windows".

Specified by:
supports in interface Verifier
Returns:
if this operating system is supported
Throws:
SecurityException - because System properties may be queried
See Also:
Verifier.supports()

verifyModuleName

public String verifyModuleName(String module)
Returns the default module name if the module name is null or an empty String. If the module name contains forward slashes (/), they are converted to backward slashes (\).

Specified by:
verifyModuleName in interface Verifier
Parameters:
module - the module name, may be null
Returns:
a module name, possibly modified, never null
See Also:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/loadlibrary.asp , Verifier.verifyModuleName(java.lang.String)

verifyFunctionName

public String verifyFunctionName(String function)
Throws a NullPointerException if the function name is null or an empty String. No further processing is done.

Specified by:
verifyFunctionName in interface Verifier
Parameters:
function - the function name, may be null
Returns:
a function name, possibly modified, never null
See Also:
Verifier.verifyFunctionName(java.lang.String)

getDefaultModule

public String getDefaultModule()
Returns "kernel32".

Specified by:
getDefaultModule in interface Verifier
Returns:
"kernel32"
See Also:
Verifier.getDefaultModule()

handleString

public Object handleString(String val,
                           String module,
                           String function)
If the function name ends on 'W' (Windows' Unicode functions), a char array is returned, otherwise a byte array is returned.

The arrays are always null-terminated.

Specified by:
handleString in interface Verifier
Parameters:
val - the String, never null
module - the module name, never null
function - the function name, never null
Returns:
the String converted, never null
See Also:
Verifier.handleString(java.lang.String, java.lang.String, java.lang.String)