- java.lang.Object
-
- de.ibapl.jnhw.common.memory.AbstractNativeMemory
-
- de.ibapl.jnhw.common.memory.OpaqueMemory32
-
- All Implemented Interfaces:
Native
- Direct Known Subclasses:
Memory32Heap,NativeIntNumber,NativeRunnable,PointerArray32,Struct32,StructArray32
public abstract class OpaqueMemory32 extends AbstractNativeMemory implements Native
The base class for any chunk (i.e. pointer to or structs) of native memory. The run method in MemoryCleaner will clean up the allocated memory after finalizing this instance - if this instance owns the memory.- Author:
- aploese
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceOpaqueMemory32.OpaqueMemory32Producer<T extends OpaqueMemory32,P extends AbstractNativeMemory>-
Nested classes/interfaces inherited from class de.ibapl.jnhw.common.memory.AbstractNativeMemory
AbstractNativeMemory.SetMem
-
-
Field Summary
Fields Modifier and Type Field Description intsizeInBytes-
Fields inherited from class de.ibapl.jnhw.common.memory.AbstractNativeMemory
baseAddress, CLEANER, LOG, MEM_ACCESS, MEM_ACCESS_PROPERTY, NULL, parent
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedOpaqueMemory32(AbstractNativeMemory owner, long offset, int sizeInBytes, AbstractNativeMemory.SetMem setMem)protectedOpaqueMemory32(NativeAddressHolder addressHolder, int sizeInBytes)Create a static memory slice which will NOT be freed - its static.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static voidcheckIndex(OpaqueMemory32 mem, int offset, int length)static voidclear(OpaqueMemory32 mem)static voidcopy(byte[] src, int srcPos, OpaqueMemory32 dest, int destPos, int length)static voidcopy(OpaqueMemory32 src, int srcPos, byte[] dest, int destPos, int length)booleanequals(Object obj)static bytegetByte(OpaqueMemory32 mem, int index)protected longgetSizeInBytes()inthashCode()static voidmemset(OpaqueMemory32 mem, byte c)StringnativeToString()voidnativeToString(Appendable sb, String indentPrefix, String indent)static StringprintMemory(OpaqueMemory32 mem, boolean printAddress)static voidprintMemory(Appendable sb, OpaqueMemory32 mem, boolean printAddress)static voidsetByte(OpaqueMemory32 mem, int index, byte value)static <T extends OpaqueMemory32>
TsetMemTo(T mem, byte value)static byte[]toBytes(OpaqueMemory32 mem)StringtoString()-
Methods inherited from class de.ibapl.jnhw.common.memory.AbstractNativeMemory
calcOffsetForAlignment, getOffset, getSizeInBytes, isSameAddress, offsetof, toNativeAddressHolder, toUintptr_t, toUintptr_tOrNULL
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface de.ibapl.jnhw.common.datatypes.Native
getBaseDataType, nativeToHexString
-
-
-
-
Constructor Detail
-
OpaqueMemory32
protected OpaqueMemory32(NativeAddressHolder addressHolder, int sizeInBytes)
Create a static memory slice which will NOT be freed - its static.- Parameters:
addressHolder- the base address.sizeInBytes- the size.
-
OpaqueMemory32
protected OpaqueMemory32(AbstractNativeMemory owner, long offset, int sizeInBytes, AbstractNativeMemory.SetMem setMem)
- Parameters:
owner-offset-sizeInBytes-
-
-
Method Detail
-
checkIndex
public static void checkIndex(OpaqueMemory32 mem, int offset, int length)
-
clear
public static void clear(OpaqueMemory32 mem)
-
setMemTo
public static <T extends OpaqueMemory32> T setMemTo(T mem, byte value)
-
copy
public static void copy(byte[] src, int srcPos, OpaqueMemory32 dest, int destPos, int length)
-
copy
public static void copy(OpaqueMemory32 src, int srcPos, byte[] dest, int destPos, int length)
-
memset
public static void memset(OpaqueMemory32 mem, byte c)
-
getByte
public static byte getByte(OpaqueMemory32 mem, int index)
-
setByte
public static void setByte(OpaqueMemory32 mem, int index, byte value)
-
toBytes
public static byte[] toBytes(OpaqueMemory32 mem)
-
nativeToString
public void nativeToString(Appendable sb, String indentPrefix, String indent) throws IOException
- Specified by:
nativeToStringin interfaceNative- Throws:
IOException
-
nativeToString
public String nativeToString()
- Specified by:
nativeToStringin interfaceNative
-
printMemory
public static final String printMemory(OpaqueMemory32 mem, boolean printAddress)
-
printMemory
public static final void printMemory(Appendable sb, OpaqueMemory32 mem, boolean printAddress) throws IOException
- Throws:
IOException
-
getSizeInBytes
protected final long getSizeInBytes()
- Specified by:
getSizeInBytesin classAbstractNativeMemory
-
-