com.jniwrapper.win32.system
Class LocalMemoryBlock

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

public class LocalMemoryBlock
extends Handle

This class represents a local memory block and corresponds to the HLOCAL 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
LocalMemoryBlock()
          Creates a LocalMemoryBlock object.
LocalMemoryBlock(Handle handle)
          Creates a LocalMemoryBlock object that references the memory that handles references.
LocalMemoryBlock(int size, MemoryAllocationAttributes attributes)
          Allocates a local memory block of the specified size.
 
Method Summary
 void free()
          Frees the allocated memory.
static void localFree(com.jniwrapper.Parameter localMemoryBlock)
          Frees the allocated memory.
 Handle lock()
          Locks the memory block and returns a 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, 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

LocalMemoryBlock

public LocalMemoryBlock()
Creates a LocalMemoryBlock object.


LocalMemoryBlock

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

Parameters:
handle - handle to the local memory block

LocalMemoryBlock

public LocalMemoryBlock(int size,
                        MemoryAllocationAttributes attributes)
Allocates a local 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.

Throws:
java.lang.RuntimeException - if failed to free the memory block.

localFree

public static void localFree(com.jniwrapper.Parameter localMemoryBlock)
Frees the allocated memory.

Throws:
java.lang.RuntimeException - if failed to free the memory block.

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 a 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 GetLastError function returns NO_ERROR, the memory block is unlocked.