-
public interface MemoryChunk
-
-
Method Summary
Modifier and Type Method Description abstract Unitclose()This has to be called before we get rid of this object in order to release underlying memory abstract BooleanisClosed()Check if this chunk is already closed abstract Integerwrite(Integer memoryOffset, ByteArray byteArray, Integer byteArrayOffset, Integer count)Copy bytes from byte array to buffer. abstract Integerread(Integer memoryOffset, ByteArray byteArray, Integer byteArrayOffset, Integer count)Copy bytes from memory to byte array. abstract Byteread(Integer offset)Read byte at given offset. abstract Unitcopy(Integer offset, MemoryChunk other, Integer otherOffset, Integer count)Copy bytes from buffer memory wrapped by this MemoryChunk instance to buffer memory wrapped by another MemoryChunk. abstract IntegergetSize()Get the size of this memory chunk. abstract LonggetNativePtr()Gets the pointer the native memory. abstract ByteBuffergetByteBuffer()Gets the ByteBuffer associated with the memory chunk if available, else null. abstract LonggetUniqueId()Gets the unique identifier associated with the memory chunk. -
-
Method Detail
-
close
abstract Unit close()
This has to be called before we get rid of this object in order to release underlying memory
-
write
abstract Integer write(Integer memoryOffset, ByteArray byteArray, Integer byteArrayOffset, Integer count)
Copy bytes from byte array to buffer.
- Parameters:
memoryOffset- number of first byte to be written by copy operationbyteArray- byte array to copy frombyteArrayOffset- number of first byte in byteArray to copycount- number of bytes to copy
-
read
abstract Integer read(Integer memoryOffset, ByteArray byteArray, Integer byteArrayOffset, Integer count)
Copy bytes from memory to byte array.
- Parameters:
memoryOffset- number of first byte to copybyteArray- byte array to copy tobyteArrayOffset- number of first byte in byte array to be writtencount- number of bytes to copy
-
read
abstract Byte read(Integer offset)
Read byte at given offset.
- Parameters:
offset- The offset from which the byte will be read
-
copy
abstract Unit copy(Integer offset, MemoryChunk other, Integer otherOffset, Integer count)
Copy bytes from buffer memory wrapped by this MemoryChunk instance to buffer memory wrapped by another MemoryChunk. The two MemoryChunks should have the same type.
- Parameters:
offset- number of first byte to copyother- other MemoryChunk to copy tootherOffset- number of first byte to write tocount- number of bytes to copy
-
getSize
abstract Integer getSize()
Get the size of this memory chunk. Ignores if this chunk has been closed
-
getNativePtr
abstract Long getNativePtr()
Gets the pointer the native memory.
-
getByteBuffer
abstract ByteBuffer getByteBuffer()
Gets the ByteBuffer associated with the memory chunk if available, else null.
-
getUniqueId
abstract Long getUniqueId()
Gets the unique identifier associated with the memory chunk.
-
-
-
-