com.jniwrapper.win32.system
Class GlobalMemoryBlock

java.lang.Object
  extended bycom.jniwrapper.Parameter
      extended bycom.jniwrapper.Pointer.Void
          extended bycom.jniwrapper.win32.Handle
              extended bycom.jniwrapper.win32.system.GlobalMemoryBlock
All Implemented Interfaces:
com.jniwrapper.IntegerParameter, com.jniwrapper.PointerParameter

public class GlobalMemoryBlock
extends Handle

This object represents a global memory block and corresponds to the HGLOBAL native type.


Field Summary
 
Fields inherited from class com.jniwrapper.win32.Handle
INFINITE_TIMEOUT, INVALID_HANDLE_VALUE, STATUS_ABANDONED_WAIT_0, STATUS_TIMEOUT, STATUS_WAIT_0
 
Fields inherited from class com.jniwrapper.Parameter
LICENSE_TYPE, V
 
Constructor Summary
GlobalMemoryBlock()
          Creates a global memory block.
GlobalMemoryBlock(Handle handle)
          Creates a LocalMemoryBlock object that references the memory that handle references.
GlobalMemoryBlock(int size, MemoryAllocationAttributes attributes)
          Allocates the global memory block of the specified size.
 
Method Summary
 void free()
          Frees the allocated memory.
 Handle lock()
          Locks the memory block and returns the pointer to the allocated memory.
 int size()
          Returns the size of the allocated memory block.
 int unlock()
          Decrements the lock count for the memory block.
 
Methods inherited from class com.jniwrapper.win32.Handle
clone, closeHandle, equals, waitFor, waitFor
 
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
 

Constructor Detail

GlobalMemoryBlock

public GlobalMemoryBlock()
Creates a global memory block.


GlobalMemoryBlock

public GlobalMemoryBlock(Handle handle)
Creates a LocalMemoryBlock object that references the memory that handle references.

Parameters:
handle - a handle to the local memory block

GlobalMemoryBlock

public GlobalMemoryBlock(int size,
                         MemoryAllocationAttributes attributes)
Allocates the global memory block of the specified size.

Parameters:
size - the size of the allocated memory
attributes - allocation attributes
Method Detail

free

public void free()
Frees the allocated memory.


size

public int size()
Returns the size of the allocated memory block.

Returns:
size of the allocated memory block.

lock

public Handle lock()
Locks the memory block and returns the pointer to the allocated memory.

Returns:
pointer to the allocated memory.

unlock

public int unlock()
Decrements the lock count for the memory block.

Returns:
lock count after decrementing. If the lock count is zero and the GetLastError function returns NO_ERROR, the memory block is unlocked.