Uses of Interface
jdk.incubator.foreign.MemorySegment
Package | Description |
---|---|
jdk.incubator.foreign |
Classes to support low-level, safe and efficient memory access.
|
-
Uses of MemorySegment in jdk.incubator.foreign
Subinterfaces of MemorySegment in jdk.incubator.foreign Modifier and Type Interface Description interface
MappedMemorySegment
A mapped memory segment, that is, a memory segment backed by memory-mapped file.Methods in jdk.incubator.foreign with type parameters of type MemorySegment Modifier and Type Method Description static <S extends MemorySegment>
Spliterator<S>MemorySegment. spliterator(S segment, SequenceLayout layout)
Returns a spliterator for the given memory segment.Methods in jdk.incubator.foreign that return MemorySegment Modifier and Type Method Description static MemorySegment
MemorySegment. allocateNative(long bytesSize)
Creates a new native memory segment that models a newly allocated block of off-heap memory with given size (in bytes).static MemorySegment
MemorySegment. allocateNative(long bytesSize, long alignmentBytes)
Creates a new native memory segment that models a newly allocated block of off-heap memory with given size and alignment constraint (in bytes).static MemorySegment
MemorySegment. allocateNative(MemoryLayout layout)
Creates a new native memory segment that models a newly allocated block of off-heap memory with given layout.MemorySegment
MemorySegment. asSlice(long offset, long newSize)
Obtains a new memory segment view whose base address is the same as the base address of this segment plus a given offset, and whose new size is specified by the given argument.MemorySegment
MemorySegment. fill(byte value)
Fills a value into this memory segment.static MemorySegment
MemorySegment. ofArray(byte[] arr)
Creates a new array memory segment that models the memory associated with a given heap-allocated byte array.static MemorySegment
MemorySegment. ofArray(char[] arr)
Creates a new array memory segment that models the memory associated with a given heap-allocated char array.static MemorySegment
MemorySegment. ofArray(double[] arr)
Creates a new array memory segment that models the memory associated with a given heap-allocated double array.static MemorySegment
MemorySegment. ofArray(float[] arr)
Creates a new array memory segment that models the memory associated with a given heap-allocated float array.static MemorySegment
MemorySegment. ofArray(int[] arr)
Creates a new array memory segment that models the memory associated with a given heap-allocated int array.static MemorySegment
MemorySegment. ofArray(long[] arr)
Creates a new array memory segment that models the memory associated with a given heap-allocated long array.static MemorySegment
MemorySegment. ofArray(short[] arr)
Creates a new array memory segment that models the memory associated with a given heap-allocated short array.static MemorySegment
MemorySegment. ofByteBuffer(ByteBuffer bb)
Creates a new buffer memory segment that models the memory associated with the given byte buffer.static MemorySegment
MemorySegment. ofNativeRestricted(MemoryAddress addr, long bytesSize, Thread owner, Runnable cleanup, Object attachment)
Returns a new native memory segment with given base address and size; the returned segment has its own temporal bounds, and can therefore be closed; closing such a segment can optionally result in calling an user-provided cleanup action.MemorySegment
MemoryAddress. segment()
Returns the memory segment (if any) this address belongs to.MemorySegment
MemorySegment. withAccessModes(int accessModes)
Obtains a segment view with specific access modes.MemorySegment
MemorySegment. withOwnerThread(Thread newOwner)
Obtains a new memory segment backed by the same underlying memory region as this segment, but with different owner thread.Methods in jdk.incubator.foreign with parameters of type MemorySegment Modifier and Type Method Description void
MemorySegment. copyFrom(MemorySegment src)
Performs a bulk copy from given source segment to this segment.long
MemorySegment. mismatch(MemorySegment other)
Finds and returns the offset, in bytes, of the first mismatch between this segment and a given other segment.MemoryAddress
MemoryAddress. rebase(MemorySegment segment)
Reinterpret this address as an offset into the provided segment.