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 interfaceMappedMemorySegmentA 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 MemorySegmentMemorySegment. 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 MemorySegmentMemorySegment. 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 MemorySegmentMemorySegment. allocateNative(MemoryLayout layout)Creates a new native memory segment that models a newly allocated block of off-heap memory with given layout.MemorySegmentMemorySegment. 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.MemorySegmentMemorySegment. fill(byte value)Fills a value into this memory segment.static MemorySegmentMemorySegment. ofArray(byte[] arr)Creates a new array memory segment that models the memory associated with a given heap-allocated byte array.static MemorySegmentMemorySegment. ofArray(char[] arr)Creates a new array memory segment that models the memory associated with a given heap-allocated char array.static MemorySegmentMemorySegment. ofArray(double[] arr)Creates a new array memory segment that models the memory associated with a given heap-allocated double array.static MemorySegmentMemorySegment. ofArray(float[] arr)Creates a new array memory segment that models the memory associated with a given heap-allocated float array.static MemorySegmentMemorySegment. ofArray(int[] arr)Creates a new array memory segment that models the memory associated with a given heap-allocated int array.static MemorySegmentMemorySegment. ofArray(long[] arr)Creates a new array memory segment that models the memory associated with a given heap-allocated long array.static MemorySegmentMemorySegment. ofArray(short[] arr)Creates a new array memory segment that models the memory associated with a given heap-allocated short array.static MemorySegmentMemorySegment. ofByteBuffer(ByteBuffer bb)Creates a new buffer memory segment that models the memory associated with the given byte buffer.static MemorySegmentMemorySegment. 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.MemorySegmentMemoryAddress. segment()Returns the memory segment (if any) this address belongs to.MemorySegmentMemorySegment. withAccessModes(int accessModes)Obtains a segment view with specific access modes.MemorySegmentMemorySegment. 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 voidMemorySegment. copyFrom(MemorySegment src)Performs a bulk copy from given source segment to this segment.longMemorySegment. mismatch(MemorySegment other)Finds and returns the offset, in bytes, of the first mismatch between this segment and a given other segment.MemoryAddressMemoryAddress. rebase(MemorySegment segment)Reinterpret this address as an offset into the provided segment.