Package space.kscience.kmath.memory

Types

Memory
Link copied to clipboard
common
interface Memory
Represents a display of certain memory structure.
MemoryReader
Link copied to clipboard
common
interface MemoryReader
The interface to read primitive types in this memory.
MemorySpec
Link copied to clipboard
common
interface MemorySpec<T : Any>
A specification to read or write custom objects with fixed size in bytes.
MemoryWriter
Link copied to clipboard
common
interface MemoryWriter
The interface to write primitive types into this memory.

Functions

allocate
Link copied to clipboard
common
fun Memory.Companion.allocate(length: Int): Memory
Allocates the most effective platform-specific memory.
js
fun Memory.Companion.allocate(length: Int): Memory
Allocates memory based on a DataView.
fun Memory.Companion.allocate(length: Int): Memory
Allocates memory based on a ByteBuffer.
native
fun Memory.Companion.allocate(length: Int): Memory
Allocates the most effective platform-specific memory.
asMemory
Link copied to clipboard
fun ByteBuffer.asMemory(startOffset: Int = 0, size: Int = limit()): Memory
Wraps this ByteBuffer to Memory object.
read
Link copied to clipboard
common
inline fun <R> Memory.read(block: MemoryReader.() -> R): R
Uses the memory for read then releases the reader.
fun <T : Any> MemoryReader.read(spec: MemorySpec<T>, offset: Int): T
Reads the object with spec starting from offset.
readArray
Link copied to clipboard
common
inline fun <T : Any> MemoryReader.readArray(spec: MemorySpec<T>, offset: Int, size: Int): Array<T>
Reads array of size objects mapped by spec at certain offset.
readAsMemory
Link copied to clipboard
inline fun <R> Path.readAsMemory(position: Long = 0, size: Long = Files.size(this), block: Memory.() -> R): R
Uses direct memory-mapped buffer from file to read something and close it afterwards.
wrap
Link copied to clipboard
common
fun Memory.Companion.wrap(array: ByteArray): Memory
Wraps a Memory around existing ByteArray.
js
fun Memory.Companion.wrap(array: ByteArray): Memory
Wraps a Memory around existing ByteArray.
fun Memory.Companion.wrap(array: ByteArray): Memory
Wraps a Memory around existing ByteArray.
native
fun Memory.Companion.wrap(array: ByteArray): Memory
Wraps a Memory around existing ByteArray.
write
Link copied to clipboard
common
inline fun Memory.write(block: MemoryWriter.() -> Unit)
Uses the memory for write then releases the writer.
fun <T : Any> MemoryWriter.write(spec: MemorySpec<T>, offset: Int, value: T)
Writes the object value with spec starting from offset.
writeArray
Link copied to clipboard
common
fun <T : Any> MemoryWriter.writeArray(spec: MemorySpec<T>, offset: Int, array: Array<T>)
Writes array of objects mapped by spec at certain offset.