com.jniwrapper.win32
Class Handle

java.lang.Object
  extended bycom.jniwrapper.Parameter
      extended bycom.jniwrapper.Pointer.Void
          extended bycom.jniwrapper.win32.Handle
All Implemented Interfaces:
com.jniwrapper.IntegerParameter, com.jniwrapper.PointerParameter
Direct Known Subclasses:
AccessToken, DC, EventLog, EventObject, GdiObject, GlobalMemoryBlock, LocalMemoryBlock, Module, Mutex, Process, ProcessVariables, RegistryKey, com.jniwrapper.win32.service.ScHandle, Snapshot, Wnd

public class Handle
extends com.jniwrapper.Pointer.Void

A base class for all handle types.


Field Summary
static int INFINITE_TIMEOUT
          Specifies the infinite timeout value for waitFor(Handle, long) function.
static int INVALID_HANDLE_VALUE
          Specifies invalid handle value.
static int STATUS_ABANDONED_WAIT_0
          Specifies the abandoned status value of waitFor(Handle, long) or waitFor(Handle) functions.
static int STATUS_TIMEOUT
          Specifies the timeout status value of waitFor(Handle, long) or waitFor(Handle) functions.
static int STATUS_WAIT_0
          Specifies the status value of waitFor(Handle, long) or waitFor(Handle) functions.
 
Fields inherited from class com.jniwrapper.Parameter
LICENSE_TYPE, V
 
Constructor Summary
Handle()
          Constucts a blank handle instance.
Handle(long value)
          Constructs a handle with the passed value.
 
Method Summary
 java.lang.Object clone()
           
static boolean closeHandle(Handle handle)
          Closes the opened object handle.
 boolean equals(java.lang.Object obj)
           
static long waitFor(Handle handle)
          Causes the current thread to wait on this handle infinitely.
static long waitFor(Handle handle, long timeout)
          Causes the current thread to wait on this handle the specified number of milliseconds.
This function is the wrapper for WaitForSingleObject Windows API function.
 
Methods inherited from class com.jniwrapper.Pointer.Void
asFunction, asFunction, asTypedPointer, castTo, getDebugInfo, getLength, getValue, hashCode, isNull, read, setValue, toString, write
 
Methods inherited from class com.jniwrapper.Parameter
, a, a, acceptIOPerformer, asReturnValue, b, dataBufferAssigned, getAlignedLength, getAlignmentRequirement, getDataBuffer, getDataBufferOffset, indent, pop, push, read, read, setDataBuffer, toByteArray, write
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

INFINITE_TIMEOUT

public static final int INFINITE_TIMEOUT
Specifies the infinite timeout value for waitFor(Handle, long) function.

See Also:
Constant Field Values

STATUS_WAIT_0

public static final int STATUS_WAIT_0
Specifies the status value of waitFor(Handle, long) or waitFor(Handle) functions.

See Also:
Constant Field Values

STATUS_ABANDONED_WAIT_0

public static final int STATUS_ABANDONED_WAIT_0
Specifies the abandoned status value of waitFor(Handle, long) or waitFor(Handle) functions.

See Also:
Constant Field Values

STATUS_TIMEOUT

public static final int STATUS_TIMEOUT
Specifies the timeout status value of waitFor(Handle, long) or waitFor(Handle) functions.

See Also:
Constant Field Values

INVALID_HANDLE_VALUE

public static final int INVALID_HANDLE_VALUE
Specifies invalid handle value.

See Also:
Constant Field Values
Constructor Detail

Handle

public Handle()
Constucts a blank handle instance.


Handle

public Handle(long value)
Constructs a handle with the passed value.

Parameters:
value - handle value.
Method Detail

clone

public java.lang.Object clone()

equals

public boolean equals(java.lang.Object obj)

waitFor

public static long waitFor(Handle handle,
                           long timeout)
Causes the current thread to wait on this handle the specified number of milliseconds.
This function is the wrapper for WaitForSingleObject Windows API function.

Parameters:
handle - handle to wait for
timeout - Time-out interval, in milliseconds
Returns:
wait status
Since:
3.6

waitFor

public static long waitFor(Handle handle)
Causes the current thread to wait on this handle infinitely.

Parameters:
handle - handle to wait for
Returns:
wait status
Since:
3.6

closeHandle

public static boolean closeHandle(Handle handle)
Closes the opened object handle. This method closes handles to the following objects:
This function is the wrapper for CloseHandle Windows API function.

Parameters:
handle - handle to an opened object
Returns:
true if the function succeeds, false - otherwise.