org.jnetpcap.nio
Class JMemoryPool.Block

java.lang.Object
  extended by org.jnetpcap.nio.JMemory
      extended by org.jnetpcap.nio.JMemoryPool.Block
Enclosing class:
JMemoryPool

public static class JMemoryPool.Block
extends JMemory

A block of native memory allocated with malloc. This block is further sub allocated on a per request basis using the method allocate(int).

Author:
Sly Technologies, Inc.

Nested Class Summary
 
Nested classes/interfaces inherited from class org.jnetpcap.nio.JMemory
JMemory.Type
 
Field Summary
 
Fields inherited from class org.jnetpcap.nio.JMemory
JNETPCAP_LIBRARY_NAME, MAX_DIRECT_MEMORY_DEFAULT, POINTER
 
Method Summary
 int allocate(int size)
          Allocates requested size number of bytes from existing memory block.
 void free(int offset, int length)
          Frees the existing memory to be put back in the memory pool.
 java.lang.String toString()
          To string.
 
Methods inherited from class org.jnetpcap.nio.JMemory
availableDirectMemory, check, cleanup, createReference, isInitialized, isJMemoryBasedOwner, isOwner, maxDirectMemory, peer, peer, peer, reservedDirectMemory, setSize, size, softDirectMemory, toDebugString, toHexdump, toHexdump, totalActiveAllocated, totalAllocateCalls, totalAllocated, totalAllocatedSegments0To255Bytes, totalAllocatedSegments256OrAbove, totalDeAllocateCalls, totalDeAllocated, transferFrom, transferFrom, transferFrom, transferFrom, transferFromDirect, transferOwnership, transferTo, transferTo, transferTo, transferTo, transferTo, transferTo, transferTo, transferTo0
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

allocate

public int allocate(int size)
Allocates requested size number of bytes from existing memory block.

Parameters:
size - number of bytes
Returns:
offset into the buffer where the allocated memory begins

free

public void free(int offset,
                 int length)
Frees the existing memory to be put back in the memory pool.

Parameters:
offset - the offset
length - the length

toString

public java.lang.String toString()
To string.

Overrides:
toString in class java.lang.Object
Returns:
the string
See Also:
Object.toString()