Package 

Interface MemoryChunk

    • Method Summary

      Modifier and Type Method Description
      abstract Unit close() This has to be called before we get rid of this object in order to release underlying memory
      abstract Boolean isClosed() Check if this chunk is already closed
      abstract Integer write(Integer memoryOffset, ByteArray byteArray, Integer byteArrayOffset, Integer count) Copy bytes from byte array to buffer.
      abstract Integer read(Integer memoryOffset, ByteArray byteArray, Integer byteArrayOffset, Integer count) Copy bytes from memory to byte array.
      abstract Byte read(Integer offset) Read byte at given offset.
      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.
      abstract Integer getSize() Get the size of this memory chunk.
      abstract Long getNativePtr() Gets the pointer the native memory.
      abstract ByteBuffer getByteBuffer() Gets the ByteBuffer associated with the memory chunk if available, else null.
      abstract Long getUniqueId() Gets the unique identifier associated with the memory chunk.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • close

         abstract Unit close()

        This has to be called before we get rid of this object in order to release underlying memory

      • isClosed

         abstract Boolean isClosed()

        Check if this chunk is already closed

      • 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 operation
        byteArray - byte array to copy from
        byteArrayOffset - number of first byte in byteArray to copy
        count - 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 copy
        byteArray - byte array to copy to
        byteArrayOffset - number of first byte in byte array to be written
        count - 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 copy
        other - other MemoryChunk to copy to
        otherOffset - number of first byte to write to
        count - number of bytes to copy
      • getSize

         abstract Integer getSize()

        Get the size of this memory chunk. Ignores if this chunk has been closed

      • 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.