Interface FragmentedMemoryInterface
-
- All Superinterfaces:
Freeable,Iterable<ContiguousMemoryInterface>,ReadWriteBytesFileChannel,SizedInBytes
- All Known Implementing Classes:
FragmentedMemory
public interface FragmentedMemoryInterface extends Iterable<ContiguousMemoryInterface>, ReadWriteBytesFileChannel, SizedInBytes, Freeable
Fragmented memory objects are lists of contiguous memory regions. Overall, the referenced memory is not necessarily (but can be) contiguous.- Author:
- royer
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description OffHeapMemoryadd(Buffer pNIOBuffer)Adds a NIO buffer to this fragmented memory.voidadd(ContiguousMemoryInterface pContiguousMemory)Adds a contiguous memory fragment to this fragmented memoryContiguousMemoryInterfaceget(int pFragmentIndex)Returns the contiguous memory at a given index.intgetNumberOfFragments()Returns the number of fragments.OffHeapMemorymakeConsolidatedCopy()Returns a consolidated contiguous copy of this fragmented memory - this is done by simply concatenating the contiguous memory regions together in the list order.voidmakeConsolidatedCopy(ContiguousMemoryInterface pDestinationMemory)Consolidates (copies) the contents of this fragmented memory into a given contiguous buffer.voidremove(ContiguousMemoryInterface pContiguousMemory)Removes a counties fragment from this fragmented memory.-
Methods inherited from interface net.haesleinhuepf.clij.coremem.rgc.Freeable
complainIfFreed, free, isFree
-
Methods inherited from interface java.lang.Iterable
forEach, iterator, spliterator
-
Methods inherited from interface net.haesleinhuepf.clij.coremem.interfaces.ReadWriteBytesFileChannel
readBytesFromFileChannel, readBytesFromFileChannel, writeBytesToFileChannel, writeBytesToFileChannel
-
Methods inherited from interface net.haesleinhuepf.clij.coremem.interfaces.SizedInBytes
getSizeInBytes
-
-
-
-
Method Detail
-
getNumberOfFragments
int getNumberOfFragments()
Returns the number of fragments.- Returns:
- number of fragments
-
get
ContiguousMemoryInterface get(int pFragmentIndex)
Returns the contiguous memory at a given index.- Parameters:
pFragmentIndex- index- Returns:
- contiguous memory
-
add
void add(ContiguousMemoryInterface pContiguousMemory)
Adds a contiguous memory fragment to this fragmented memory- Parameters:
pContiguousMemory- contiguous fragment
-
remove
void remove(ContiguousMemoryInterface pContiguousMemory)
Removes a counties fragment from this fragmented memory.- Parameters:
pContiguousMemory- ?
-
add
OffHeapMemory add(Buffer pNIOBuffer)
Adds a NIO buffer to this fragmented memory.- Parameters:
pNIOBuffer- NIO buffer- Returns:
- the actual contiguous memory used internally.
-
makeConsolidatedCopy
OffHeapMemory makeConsolidatedCopy()
Returns a consolidated contiguous copy of this fragmented memory - this is done by simply concatenating the contiguous memory regions together in the list order.- Returns:
- consolidated memory
-
makeConsolidatedCopy
void makeConsolidatedCopy(ContiguousMemoryInterface pDestinationMemory)
Consolidates (copies) the contents of this fragmented memory into a given contiguous buffer.- Parameters:
pDestinationMemory- destination memory
-
-