Package net.haesleinhuepf.clij.coremem
Class MemoryBase
- java.lang.Object
-
- net.haesleinhuepf.clij.coremem.rgc.FreeableBase
-
- net.haesleinhuepf.clij.coremem.MemoryBase
-
- All Implemented Interfaces:
ContiguousMemoryInterface,BridJPointerWrappable,ByteBufferWrappable,Copyable<ContiguousMemoryInterface>,CopyFromToJavaArray,CopyFromToNIOBuffers,CopyRangeFromToJavaArray,JNAPointerWrappable,MemoryTyped,PointerAccessible,RangeCopyable<MemoryBase>,ReadAt,ReadAtAligned,ReadWriteBytesFileChannel,SizedInBytes,WriteAt,WriteAtAligned,Cleanable,Freeable
- Direct Known Subclasses:
MappedMemoryBase,OffHeapMemory
public abstract class MemoryBase extends FreeableBase implements PointerAccessible, SizedInBytes, ContiguousMemoryInterface, RangeCopyable<MemoryBase>, Freeable, Cleanable
This abstract base class offers basic functionality for off-heap memory access, copying, sizing, and memory life-cycle management and garbage collection.- Author:
- royer
-
-
Field Summary
Fields Modifier and Type Field Description protected longmAddressInBytesprotected booleanmIsFreeprotected longmLengthInBytes
-
Constructor Summary
Constructors Modifier Constructor Description protectedMemoryBase()Protected parameterless constructorMemoryBase(long pAddressInBytes, long pLengtInBytes)Constructs a MemoryBase given an address and length (absolute and all in bytes).
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidcopyFrom(byte[] pFrom)Copies the content of a byte array to this memory object.voidcopyFrom(byte[] pFrom, int pSrcOffset, long pDstOffset, int pLength)Copies the content of a byte array to this memory object.voidcopyFrom(char[] pFrom)Copies the content of a char array to this memory object.voidcopyFrom(char[] pFrom, int pSrcOffset, long pDstOffset, int pLength)Copies the content of a char array to this memory object.voidcopyFrom(double[] pFrom)Copies the content of a double array to this memory object.voidcopyFrom(double[] pFrom, int pSrcOffset, long pDstOffset, int pLength)Copies the content of a double array to this memory object.voidcopyFrom(float[] pFrom)Copies the content of a float array to this memory object.voidcopyFrom(float[] pFrom, int pSrcOffset, long pDstOffset, int pLength)Copies the content of a float array to this memory object.voidcopyFrom(int[] pFrom)Copies the content of a int array to this memory object.voidcopyFrom(int[] pFrom, int pSrcOffset, long pDstOffset, int pLength)Copies the content of a int array to this memory object.voidcopyFrom(long[] pFrom)Copies the content of a long array to this memory object.voidcopyFrom(long[] pFrom, int pSrcOffset, long pDstOffset, int pLength)Copies the content of a long array to this memory object.voidcopyFrom(short[] pFrom)Copies the content of a short array to this memory object.voidcopyFrom(short[] pFrom, int pSrcOffset, long pDstOffset, int pLength)Copies the content of a short array to this memory object.voidcopyFrom(Buffer pBuffer)Copy from NIO buffer.voidcopyFrom(ContiguousMemoryInterface pFrom)Copies an other memory object entirely into this one.voidcopyRangeTo(long pSourceOffset, MemoryBase pTo, long pDestinationOffset, long pLengthToCopy)Copies range (offset_src,length) from this memory object to the range (offset_src,length) of a generic destination.voidcopyTo(byte[] pTo)Copies the content of that memory object to a byte array.voidcopyTo(byte[] pTo, long pSrcOffset, int pDstOffset, int pLength)Copies the content of that memory object to a byte array.voidcopyTo(char[] pTo)Copies the content of that memory object to a char array.voidcopyTo(char[] pTo, long pSrcOffset, int pDstOffset, int pLength)Copies the content of that memory object to a char array.voidcopyTo(double[] pTo)Copies the content of that memory object to a double array.voidcopyTo(double[] pTo, long pSrcOffset, int pDstOffset, int pLength)Copies the content of that memory object to a double array.voidcopyTo(float[] pTo)Copies the content of that memory object to a float array.voidcopyTo(float[] pTo, long pSrcOffset, int pDstOffset, int pLength)Copies the content of that memory object to a float array.voidcopyTo(int[] pTo)Copies the content of that memory object to a int array.voidcopyTo(int[] pTo, long pSrcOffset, int pDstOffset, int pLength)Copies the content of that memory object to a int array.voidcopyTo(long[] pTo)Copies the content of that memory object to a long array.voidcopyTo(long[] pTo, long pSrcOffset, int pDstOffset, int pLength)Copies the content of that memory object to a long array.voidcopyTo(short[] pTo)Copies the content of that memory object to a short array.voidcopyTo(short[] pTo, long pSrcOffset, int pDstOffset, int pLength)Copies the content of that memory object to a short array.voidcopyTo(Buffer pBuffer)Copy to NIO buffer.voidcopyTo(ContiguousMemoryInterface pTo)Copies this memory object entirely into an other.voidfree()Free this object, which means that the underlying ressources are released.longgetAddress()Returns the memory's address.org.bridj.PointergetBridJPointer(Class pTargetClass)Returns a BridJ pointer for this memory.bytegetByte(long pOffset)Reads a value at a given offset.bytegetByteAligned(long pOffset)Reads a value at a given offset.ByteBuffergetByteBuffer()Returns NIO ByteBufferchargetChar(long pOffset)Reads a value at a given offset.chargetCharAligned(long pOffset)Reads a value at a given offset.doublegetDouble(long pOffset)Reads a value at a given offset.doublegetDoubleAligned(long pOffset)Reads a value at a given offset.floatgetFloat(long pOffset)Reads a value at a given offset.floatgetFloatAligned(long pOffset)Reads a value at a given offset.intgetInt(long pOffset)Reads a value at a given offset.intgetIntAligned(long pOffset)Reads a value at a given offset.com.sun.jna.PointergetJNAPointer()Rerturn a JNA pointer.longgetLong(long pOffset)Reads a value at a given offset.longgetLongAligned(long pOffset)Reads a value at a given offset.abstract MemoryTypegetMemoryType()Returns this memory object type.shortgetShort(long pOffset)Reads a value at a given offset.shortgetShortAligned(long pOffset)Reads a value at a given offset.longgetSizeInBytes()Return this memory object's size in bytes.booleanisFree()Returns true if the object has been freed, which usually means that the underlying ressources are not longer available.longreadBytesFromFileChannel(long pPositionInBufferInBytes, FileChannel pFileChannel, long pFilePositionInBytes, long pLengthInBytes)longreadBytesFromFileChannel(FileChannel pFileChannel, long pFilePositionInBytes, long pLengthInBytes)Reads data into this memory object for a certain position of a file channel.voidsetByte(long pOffset, byte pValue)Writes a value at a given offset.voidsetByteAligned(long pOffset, byte pValue)Writes a value at a given offset.voidsetChar(long pOffset, char pValue)Writes a value at a given offset.voidsetCharAligned(long pOffset, char pValue)Writes a value at a given offset.voidsetDouble(long pOffset, double pValue)Writes a value at a given offset.voidsetDoubleAligned(long pOffset, double pValue)Writes a value at a given offset.voidsetFloat(long pOffset, float pValue)Writes a value at a given offset.voidsetFloatAligned(long pOffset, float pValue)Writes a value at a given offset.voidsetInt(long pOffset, int pValue)Writes a value at a given offset.voidsetIntAligned(long pOffset, int pValue)Writes a value at a given offset.voidsetLong(long pOffset, long pValue)Writes a value at a given offset.voidsetLongAligned(long pOffset, long pValue)Writes a value at a given offset.voidsetShort(long pOffset, short pValue)Writes a value at a given offset.voidsetShortAligned(long pOffset, short pValue)Writes a value at a given offset.longwriteBytesToFileChannel(long pPositionInBufferInBytes, FileChannel pFileChannel, long pFilePositionInBytes, long pLengthInBytes)Writes data at a given range from this memory object at a given offset of a file channel.longwriteBytesToFileChannel(FileChannel pFileChannel, long pFilePositionInBytes)Writes the whole contents of this memory object at a given offset of a file channel.-
Methods inherited from class net.haesleinhuepf.clij.coremem.rgc.FreeableBase
complainIfFreed
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface net.haesleinhuepf.clij.coremem.rgc.Cleanable
getCleaner
-
Methods inherited from interface net.haesleinhuepf.clij.coremem.ContiguousMemoryInterface
subRegion
-
Methods inherited from interface net.haesleinhuepf.clij.coremem.rgc.Freeable
complainIfFreed
-
-
-
-
Constructor Detail
-
MemoryBase
protected MemoryBase()
Protected parameterless constructor
-
MemoryBase
public MemoryBase(long pAddressInBytes, long pLengtInBytes)Constructs a MemoryBase given an address and length (absolute and all in bytes).- Parameters:
pAddressInBytes- absolute address in bytespLengtInBytes- length in bytes.
-
-
Method Detail
-
getMemoryType
public abstract MemoryType getMemoryType()
Description copied from interface:MemoryTypedReturns this memory object type.- Specified by:
getMemoryTypein interfaceMemoryTyped- Returns:
- memory type.
-
getSizeInBytes
public long getSizeInBytes()
Description copied from interface:SizedInBytesReturn this memory object's size in bytes.- Specified by:
getSizeInBytesin interfaceSizedInBytes- Returns:
- size in bytes.
-
copyFrom
public void copyFrom(ContiguousMemoryInterface pFrom)
Description copied from interface:CopyableCopies an other memory object entirely into this one.- Specified by:
copyFromin interfaceCopyable<ContiguousMemoryInterface>- Parameters:
pFrom- object to copy from
-
copyTo
public void copyTo(ContiguousMemoryInterface pTo)
Description copied from interface:CopyableCopies this memory object entirely into an other.- Specified by:
copyToin interfaceCopyable<ContiguousMemoryInterface>- Parameters:
pTo- object to copy to
-
copyRangeTo
public void copyRangeTo(long pSourceOffset, MemoryBase pTo, long pDestinationOffset, long pLengthToCopy)Description copied from interface:RangeCopyableCopies range (offset_src,length) from this memory object to the range (offset_src,length) of a generic destination.- Specified by:
copyRangeToin interfaceRangeCopyable<MemoryBase>- Parameters:
pSourceOffset- source offsetpTo- destinationpDestinationOffset- destination offsetpLengthToCopy- length to copy in bytes.
-
getAddress
public long getAddress()
Description copied from interface:PointerAccessibleReturns the memory's address.- Specified by:
getAddressin interfacePointerAccessible- Returns:
- address
-
free
public void free()
Description copied from interface:FreeableFree this object, which means that the underlying ressources are released.
-
isFree
public boolean isFree()
Description copied from interface:FreeableReturns true if the object has been freed, which usually means that the underlying ressources are not longer available.
-
setByteAligned
public void setByteAligned(long pOffset, byte pValue)Description copied from interface:WriteAtAlignedWrites a value at a given offset. The offset unit is 1 byte.- Specified by:
setByteAlignedin interfaceWriteAtAligned- Parameters:
pOffset- offsetpValue- value to set
-
setCharAligned
public void setCharAligned(long pOffset, char pValue)Description copied from interface:WriteAtAlignedWrites a value at a given offset. The offset unit is 2 bytes (1 char).- Specified by:
setCharAlignedin interfaceWriteAtAligned- Parameters:
pOffset- offsetpValue- value to set
-
setShortAligned
public void setShortAligned(long pOffset, short pValue)Description copied from interface:WriteAtAlignedWrites a value at a given offset. The offset unit is 2 bytes (1 short).- Specified by:
setShortAlignedin interfaceWriteAtAligned- Parameters:
pOffset- offsetpValue- value to set
-
setIntAligned
public void setIntAligned(long pOffset, int pValue)Description copied from interface:WriteAtAlignedWrites a value at a given offset. The offset unit is 4 bytes (1 int).- Specified by:
setIntAlignedin interfaceWriteAtAligned- Parameters:
pOffset- offsetpValue- value to set
-
setLongAligned
public void setLongAligned(long pOffset, long pValue)Description copied from interface:WriteAtAlignedWrites a value at a given offset. The offset unit is 8 bytes (1 long).- Specified by:
setLongAlignedin interfaceWriteAtAligned- Parameters:
pOffset- offsetpValue- value to set
-
setFloatAligned
public void setFloatAligned(long pOffset, float pValue)Description copied from interface:WriteAtAlignedWrites a value at a given offset. The offset unit is 4 bytes (1 float).- Specified by:
setFloatAlignedin interfaceWriteAtAligned- Parameters:
pOffset- offsetpValue- value to set
-
setDoubleAligned
public void setDoubleAligned(long pOffset, double pValue)Description copied from interface:WriteAtAlignedWrites a value at a given offset. The offset unit is 8 bytes (1 double).- Specified by:
setDoubleAlignedin interfaceWriteAtAligned- Parameters:
pOffset- offsetpValue- value to set
-
getByteAligned
public byte getByteAligned(long pOffset)
Description copied from interface:ReadAtAlignedReads a value at a given offset. The offset unit is 1 byte.- Specified by:
getByteAlignedin interfaceReadAtAligned- Parameters:
pOffset- offset- Returns:
- value
-
getCharAligned
public char getCharAligned(long pOffset)
Description copied from interface:ReadAtAlignedReads a value at a given offset. The offset unit is 2 bytes (1 char).- Specified by:
getCharAlignedin interfaceReadAtAligned- Parameters:
pOffset- offset- Returns:
- value
-
getShortAligned
public short getShortAligned(long pOffset)
Description copied from interface:ReadAtAlignedReads a value at a given offset. The offset unit is 2 bytes (1 short).- Specified by:
getShortAlignedin interfaceReadAtAligned- Parameters:
pOffset- offset- Returns:
- value
-
getIntAligned
public int getIntAligned(long pOffset)
Description copied from interface:ReadAtAlignedReads a value at a given offset. The offset unit is 4 bytes (1 int).- Specified by:
getIntAlignedin interfaceReadAtAligned- Parameters:
pOffset- offset- Returns:
- value
-
getLongAligned
public long getLongAligned(long pOffset)
Description copied from interface:ReadAtAlignedReads a value at a given offset. The offset unit is 8 bytes (1 long).- Specified by:
getLongAlignedin interfaceReadAtAligned- Parameters:
pOffset- offset- Returns:
- value
-
getFloatAligned
public float getFloatAligned(long pOffset)
Description copied from interface:ReadAtAlignedReads a value at a given offset. The offset unit is 4 bytes (1 float).- Specified by:
getFloatAlignedin interfaceReadAtAligned- Parameters:
pOffset- offset- Returns:
- value
-
getDoubleAligned
public double getDoubleAligned(long pOffset)
Description copied from interface:ReadAtAlignedReads a value at a given offset. The offset unit is 8 bytes (1 double).- Specified by:
getDoubleAlignedin interfaceReadAtAligned- Parameters:
pOffset- offset- Returns:
- value
-
setByte
public void setByte(long pOffset, byte pValue)Description copied from interface:WriteAtWrites a value at a given offset.
-
setChar
public void setChar(long pOffset, char pValue)Description copied from interface:WriteAtWrites a value at a given offset.
-
setShort
public void setShort(long pOffset, short pValue)Description copied from interface:WriteAtWrites a value at a given offset.
-
setInt
public void setInt(long pOffset, int pValue)Description copied from interface:WriteAtWrites a value at a given offset.
-
setLong
public void setLong(long pOffset, long pValue)Description copied from interface:WriteAtWrites a value at a given offset.
-
setFloat
public void setFloat(long pOffset, float pValue)Description copied from interface:WriteAtWrites a value at a given offset.
-
setDouble
public void setDouble(long pOffset, double pValue)Description copied from interface:WriteAtWrites a value at a given offset.
-
getByte
public byte getByte(long pOffset)
Description copied from interface:ReadAtReads a value at a given offset.
-
getChar
public char getChar(long pOffset)
Description copied from interface:ReadAtReads a value at a given offset.
-
getShort
public short getShort(long pOffset)
Description copied from interface:ReadAtReads a value at a given offset.
-
getInt
public int getInt(long pOffset)
Description copied from interface:ReadAtReads a value at a given offset.
-
getLong
public long getLong(long pOffset)
Description copied from interface:ReadAtReads a value at a given offset.
-
getFloat
public float getFloat(long pOffset)
Description copied from interface:ReadAtReads a value at a given offset.
-
getDouble
public double getDouble(long pOffset)
Description copied from interface:ReadAtReads a value at a given offset.
-
copyFrom
public void copyFrom(Buffer pBuffer)
Description copied from interface:CopyFromToNIOBuffersCopy from NIO buffer.- Specified by:
copyFromin interfaceCopyFromToNIOBuffers- Parameters:
pBuffer- NIO buffer
-
copyTo
public void copyTo(Buffer pBuffer)
Description copied from interface:CopyFromToNIOBuffersCopy to NIO buffer.- Specified by:
copyToin interfaceCopyFromToNIOBuffers- Parameters:
pBuffer- NIO buffer
-
writeBytesToFileChannel
public long writeBytesToFileChannel(FileChannel pFileChannel, long pFilePositionInBytes) throws IOException
Description copied from interface:ReadWriteBytesFileChannelWrites the whole contents of this memory object at a given offset of a file channel.- Specified by:
writeBytesToFileChannelin interfaceReadWriteBytesFileChannel- Parameters:
pFileChannel- file channelpFilePositionInBytes- file position- Returns:
- file position past the last written byte.
- Throws:
IOException- Thrown in case of IO problem.
-
copyTo
public void copyTo(byte[] pTo)
Description copied from interface:CopyFromToJavaArrayCopies the content of that memory object to a byte array.- Specified by:
copyToin interfaceCopyFromToJavaArray- Parameters:
pTo- preallocated byte array.
-
copyTo
public void copyTo(short[] pTo)
Description copied from interface:CopyFromToJavaArrayCopies the content of that memory object to a short array.- Specified by:
copyToin interfaceCopyFromToJavaArray- Parameters:
pTo- preallocated short array.
-
copyTo
public void copyTo(char[] pTo)
Description copied from interface:CopyFromToJavaArrayCopies the content of that memory object to a char array.- Specified by:
copyToin interfaceCopyFromToJavaArray- Parameters:
pTo- preallocated char array.
-
copyTo
public void copyTo(int[] pTo)
Description copied from interface:CopyFromToJavaArrayCopies the content of that memory object to a int array.- Specified by:
copyToin interfaceCopyFromToJavaArray- Parameters:
pTo- preallocated int array.
-
copyTo
public void copyTo(long[] pTo)
Description copied from interface:CopyFromToJavaArrayCopies the content of that memory object to a long array.- Specified by:
copyToin interfaceCopyFromToJavaArray- Parameters:
pTo- preallocated long array.
-
copyTo
public void copyTo(float[] pTo)
Description copied from interface:CopyFromToJavaArrayCopies the content of that memory object to a float array.- Specified by:
copyToin interfaceCopyFromToJavaArray- Parameters:
pTo- preallocated float array.
-
copyTo
public void copyTo(double[] pTo)
Description copied from interface:CopyFromToJavaArrayCopies the content of that memory object to a double array.- Specified by:
copyToin interfaceCopyFromToJavaArray- Parameters:
pTo- preallocated double array.
-
copyFrom
public void copyFrom(byte[] pFrom)
Description copied from interface:CopyFromToJavaArrayCopies the content of a byte array to this memory object.- Specified by:
copyFromin interfaceCopyFromToJavaArray- Parameters:
pFrom- preallocated byte array.
-
copyFrom
public void copyFrom(short[] pFrom)
Description copied from interface:CopyFromToJavaArrayCopies the content of a short array to this memory object.- Specified by:
copyFromin interfaceCopyFromToJavaArray- Parameters:
pFrom- preallocated short array.
-
copyFrom
public void copyFrom(char[] pFrom)
Description copied from interface:CopyFromToJavaArrayCopies the content of a char array to this memory object.- Specified by:
copyFromin interfaceCopyFromToJavaArray- Parameters:
pFrom- preallocated char array.
-
copyFrom
public void copyFrom(int[] pFrom)
Description copied from interface:CopyFromToJavaArrayCopies the content of a int array to this memory object.- Specified by:
copyFromin interfaceCopyFromToJavaArray- Parameters:
pFrom- preallocated int array.
-
copyFrom
public void copyFrom(long[] pFrom)
Description copied from interface:CopyFromToJavaArrayCopies the content of a long array to this memory object.- Specified by:
copyFromin interfaceCopyFromToJavaArray- Parameters:
pFrom- preallocated long array.
-
copyFrom
public void copyFrom(float[] pFrom)
Description copied from interface:CopyFromToJavaArrayCopies the content of a float array to this memory object.- Specified by:
copyFromin interfaceCopyFromToJavaArray- Parameters:
pFrom- preallocated float array.
-
copyFrom
public void copyFrom(double[] pFrom)
Description copied from interface:CopyFromToJavaArrayCopies the content of a double array to this memory object.- Specified by:
copyFromin interfaceCopyFromToJavaArray- Parameters:
pFrom- preallocated double array.
-
copyTo
public void copyTo(byte[] pTo, long pSrcOffset, int pDstOffset, int pLength)Description copied from interface:CopyRangeFromToJavaArrayCopies the content of that memory object to a byte array.- Specified by:
copyToin interfaceCopyRangeFromToJavaArray- Parameters:
pTo- preallocated byte array.pSrcOffset- source offset (array elements)pDstOffset- destination offset (array elements)pLength- length in array elements
-
copyTo
public void copyTo(short[] pTo, long pSrcOffset, int pDstOffset, int pLength)Description copied from interface:CopyRangeFromToJavaArrayCopies the content of that memory object to a short array.- Specified by:
copyToin interfaceCopyRangeFromToJavaArray- Parameters:
pTo- preallocated short array.pSrcOffset- source offset (array elements)pDstOffset- destination offset (array elements)pLength- length in array elements
-
copyTo
public void copyTo(char[] pTo, long pSrcOffset, int pDstOffset, int pLength)Description copied from interface:CopyRangeFromToJavaArrayCopies the content of that memory object to a char array.- Specified by:
copyToin interfaceCopyRangeFromToJavaArray- Parameters:
pTo- preallocated char array.pSrcOffset- source offset (array elements)pDstOffset- destination offset (array elements)pLength- length in array elements
-
copyTo
public void copyTo(int[] pTo, long pSrcOffset, int pDstOffset, int pLength)Description copied from interface:CopyRangeFromToJavaArrayCopies the content of that memory object to a int array.- Specified by:
copyToin interfaceCopyRangeFromToJavaArray- Parameters:
pTo- preallocated int array.pSrcOffset- source offset (array elements)pDstOffset- destination offset (array elements)pLength- length in array elements
-
copyTo
public void copyTo(long[] pTo, long pSrcOffset, int pDstOffset, int pLength)Description copied from interface:CopyRangeFromToJavaArrayCopies the content of that memory object to a long array.- Specified by:
copyToin interfaceCopyRangeFromToJavaArray- Parameters:
pTo- preallocated long array.pSrcOffset- source offset (array elements)pDstOffset- destination offset (array elements)pLength- length in array elements
-
copyTo
public void copyTo(float[] pTo, long pSrcOffset, int pDstOffset, int pLength)Description copied from interface:CopyRangeFromToJavaArrayCopies the content of that memory object to a float array.- Specified by:
copyToin interfaceCopyRangeFromToJavaArray- Parameters:
pTo- preallocated float array.pSrcOffset- source offset (array elements)pDstOffset- destination offset (array elements)pLength- length in array elements
-
copyTo
public void copyTo(double[] pTo, long pSrcOffset, int pDstOffset, int pLength)Description copied from interface:CopyRangeFromToJavaArrayCopies the content of that memory object to a double array.- Specified by:
copyToin interfaceCopyRangeFromToJavaArray- Parameters:
pTo- preallocated double array.pSrcOffset- source offset (array elements)pDstOffset- destination offset (array elements)pLength- length in array elements
-
copyFrom
public void copyFrom(byte[] pFrom, int pSrcOffset, long pDstOffset, int pLength)Description copied from interface:CopyRangeFromToJavaArrayCopies the content of a byte array to this memory object.- Specified by:
copyFromin interfaceCopyRangeFromToJavaArray- Parameters:
pFrom- preallocated byte array.pSrcOffset- source offset (array elements)pDstOffset- destination offset (array elements)pLength- length in array elements
-
copyFrom
public void copyFrom(short[] pFrom, int pSrcOffset, long pDstOffset, int pLength)Description copied from interface:CopyRangeFromToJavaArrayCopies the content of a short array to this memory object.- Specified by:
copyFromin interfaceCopyRangeFromToJavaArray- Parameters:
pFrom- preallocated short array.pSrcOffset- source offset (array elements)pDstOffset- destination offset (array elements)pLength- length in array elements
-
copyFrom
public void copyFrom(char[] pFrom, int pSrcOffset, long pDstOffset, int pLength)Description copied from interface:CopyRangeFromToJavaArrayCopies the content of a char array to this memory object.- Specified by:
copyFromin interfaceCopyRangeFromToJavaArray- Parameters:
pFrom- preallocated char array.pSrcOffset- source offset (array elements)pDstOffset- destination offset (array elements)pLength- length in array elements
-
copyFrom
public void copyFrom(int[] pFrom, int pSrcOffset, long pDstOffset, int pLength)Description copied from interface:CopyRangeFromToJavaArrayCopies the content of a int array to this memory object.- Specified by:
copyFromin interfaceCopyRangeFromToJavaArray- Parameters:
pFrom- preallocated int array.pSrcOffset- source offset (array elements)pDstOffset- destination offset (array elements)pLength- length in array elements
-
copyFrom
public void copyFrom(long[] pFrom, int pSrcOffset, long pDstOffset, int pLength)Description copied from interface:CopyRangeFromToJavaArrayCopies the content of a long array to this memory object.- Specified by:
copyFromin interfaceCopyRangeFromToJavaArray- Parameters:
pFrom- preallocated long array.pSrcOffset- source offset (array elements)pDstOffset- destination offset (array elements)pLength- length in array elements
-
copyFrom
public void copyFrom(float[] pFrom, int pSrcOffset, long pDstOffset, int pLength)Description copied from interface:CopyRangeFromToJavaArrayCopies the content of a float array to this memory object.- Specified by:
copyFromin interfaceCopyRangeFromToJavaArray- Parameters:
pFrom- preallocated float array.pSrcOffset- source offset (array elements)pDstOffset- destination offset (array elements)pLength- length in array elements
-
copyFrom
public void copyFrom(double[] pFrom, int pSrcOffset, long pDstOffset, int pLength)Description copied from interface:CopyRangeFromToJavaArrayCopies the content of a double array to this memory object.- Specified by:
copyFromin interfaceCopyRangeFromToJavaArray- Parameters:
pFrom- preallocated double array.pSrcOffset- source offset (array elements)pDstOffset- destination offset (array elements)pLength- length in array elements
-
writeBytesToFileChannel
public long writeBytesToFileChannel(long pPositionInBufferInBytes, FileChannel pFileChannel, long pFilePositionInBytes, long pLengthInBytes) throws IOExceptionDescription copied from interface:ReadWriteBytesFileChannelWrites data at a given range from this memory object at a given offset of a file channel.- Specified by:
writeBytesToFileChannelin interfaceReadWriteBytesFileChannel- Parameters:
pPositionInBufferInBytes- offset in memory objectpFileChannel- file channelpFilePositionInBytes- file channel offsetpLengthInBytes- length in bytes- Returns:
- file position past the last written byte.
- Throws:
IOException- Thrown in case of IO problem.
-
readBytesFromFileChannel
public long readBytesFromFileChannel(FileChannel pFileChannel, long pFilePositionInBytes, long pLengthInBytes) throws IOException
Description copied from interface:ReadWriteBytesFileChannelReads data into this memory object for a certain position of a file channel.- Specified by:
readBytesFromFileChannelin interfaceReadWriteBytesFileChannel- Parameters:
pFileChannel- file channelpFilePositionInBytes- offset in file channelpLengthInBytes- length in bytes- Returns:
- File position past the last byte read.
- Throws:
IOException- Thrown in case of IO problem.
-
readBytesFromFileChannel
public long readBytesFromFileChannel(long pPositionInBufferInBytes, FileChannel pFileChannel, long pFilePositionInBytes, long pLengthInBytes) throws IOException- Specified by:
readBytesFromFileChannelin interfaceReadWriteBytesFileChannel- Parameters:
pPositionInBufferInBytes- offset in memory objectpFileChannel- file channelpFilePositionInBytes- offset in file channelpLengthInBytes- length in bytes- Returns:
- File position past the last byte read.
- Throws:
IOException- Thrown in case of IO problem.
-
getBridJPointer
public org.bridj.Pointer getBridJPointer(Class pTargetClass)
Description copied from interface:BridJPointerWrappableReturns a BridJ pointer for this memory.- Specified by:
getBridJPointerin interfaceBridJPointerWrappable- Parameters:
pTargetClass- target class- Returns:
- BridJ
-
getJNAPointer
public com.sun.jna.Pointer getJNAPointer()
Rerturn a JNA pointer. Usefull when interacting with JNA based bindings.- Specified by:
getJNAPointerin interfaceJNAPointerWrappable- Returns:
- off-heap memory object
-
getByteBuffer
public ByteBuffer getByteBuffer()
Description copied from interface:ByteBufferWrappableReturns NIO ByteBuffer- Specified by:
getByteBufferin interfaceByteBufferWrappable- Returns:
- NIO ByteBuffer
-
-