Uses of Interface
java.lang.foreign.MemorySegment
Package
Description
Provides low-level access to memory and functions outside the Java runtime.
Defines channels, which represent connections to entities that are capable of
performing I/O operations, such as files and sockets; defines selectors, for
multiplexed, non-blocking I/O operations.
-
Uses of MemorySegmentPREVIEW in java.lang.foreign
Modifier and TypeMethodDescriptiondefault MemorySegmentPREVIEW
MemorySession.allocate
(long bytesSize, long bytesAlignment) Allocates a native segment, using this session.default MemorySegmentPREVIEW
SegmentAllocator.allocate
(long bytesSize) Allocates a memory segment with the given size.SegmentAllocator.allocate
(long bytesSize, long bytesAlignment) Allocates a memory segment with the given size and alignment constraints.default MemorySegmentPREVIEW
SegmentAllocator.allocate
(MemoryLayoutPREVIEW layout) Allocates a memory segment with the given layout.default MemorySegmentPREVIEW
SegmentAllocator.allocate
(ValueLayout.OfAddressPREVIEW layout, AddressablePREVIEW value) Allocates a memory segment with the given layout and initializes it with the given address value.default MemorySegmentPREVIEW
SegmentAllocator.allocate
(ValueLayout.OfBytePREVIEW layout, byte value) Allocates a memory segment with the given layout and initializes it with the given byte value.default MemorySegmentPREVIEW
SegmentAllocator.allocate
(ValueLayout.OfCharPREVIEW layout, char value) Allocates a memory segment with the given layout and initializes it with the given char value.default MemorySegmentPREVIEW
SegmentAllocator.allocate
(ValueLayout.OfDoublePREVIEW layout, double value) Allocates a memory segment with the given layout and initializes it with the given double value.default MemorySegmentPREVIEW
SegmentAllocator.allocate
(ValueLayout.OfFloatPREVIEW layout, float value) Allocates a memory segment with the given layout and initializes it with the given float value.default MemorySegmentPREVIEW
SegmentAllocator.allocate
(ValueLayout.OfIntPREVIEW layout, int value) Allocates a memory segment with the given layout and initializes it with the given int value.default MemorySegmentPREVIEW
SegmentAllocator.allocate
(ValueLayout.OfLongPREVIEW layout, long value) Allocates a memory segment with the given layout and initializes it with the given long value.default MemorySegmentPREVIEW
SegmentAllocator.allocate
(ValueLayout.OfShortPREVIEW layout, short value) Allocates a memory segment with the given layout and initializes it with the given short value.default MemorySegmentPREVIEW
SegmentAllocator.allocateArray
(MemoryLayoutPREVIEW elementLayout, long count) Allocates a memory segment with the given element layout and size.default MemorySegmentPREVIEW
SegmentAllocator.allocateArray
(ValueLayout.OfBytePREVIEW elementLayout, byte... elements) Allocates a memory segment with the given layout and initializes it with the given byte elements.default MemorySegmentPREVIEW
SegmentAllocator.allocateArray
(ValueLayout.OfCharPREVIEW elementLayout, char... elements) Allocates a memory segment with the given layout and initializes it with the given char elements.default MemorySegmentPREVIEW
SegmentAllocator.allocateArray
(ValueLayout.OfDoublePREVIEW elementLayout, double... elements) Allocates a memory segment with the given layout and initializes it with the given double elements.default MemorySegmentPREVIEW
SegmentAllocator.allocateArray
(ValueLayout.OfFloatPREVIEW elementLayout, float... elements) Allocates a memory segment with the given layout and initializes it with the given float elements.default MemorySegmentPREVIEW
SegmentAllocator.allocateArray
(ValueLayout.OfIntPREVIEW elementLayout, int... elements) Allocates a memory segment with the given layout and initializes it with the given int elements.default MemorySegmentPREVIEW
SegmentAllocator.allocateArray
(ValueLayout.OfLongPREVIEW elementLayout, long... elements) Allocates a memory segment with the given layout and initializes it with the given long elements.default MemorySegmentPREVIEW
SegmentAllocator.allocateArray
(ValueLayout.OfShortPREVIEW elementLayout, short... elements) Allocates a memory segment with the given layout and initializes it with the given short elements.static MemorySegmentPREVIEW
MemorySegment.allocateNative
(long bytesSize, long alignmentBytes, MemorySessionPREVIEW session) Creates a native memory segment with the given size (in bytes), alignment constraint (in bytes) and memory session.static MemorySegmentPREVIEW
MemorySegment.allocateNative
(long bytesSize, MemorySessionPREVIEW session) Creates a native memory segment with the given size (in bytes) and memory session.static MemorySegmentPREVIEW
MemorySegment.allocateNative
(MemoryLayoutPREVIEW layout, MemorySessionPREVIEW session) Creates a native memory segment with the given layout and memory session.default MemorySegmentPREVIEW
SegmentAllocator.allocateUtf8String
(String str) Converts a Java string into a UTF-8 encoded, null-terminated C string, storing the result into a memory segment.MemorySegment.asReadOnly()
Returns a read-only view of this segment.default MemorySegmentPREVIEW
MemorySegment.asSlice
(long offset) Returns a slice of this memory segment, at the given offset.MemorySegment.asSlice
(long offset, long newSize) Returns a slice of this memory segment, at the given offset.default MemorySegmentPREVIEW
MemorySegment.copyFrom
(MemorySegmentPREVIEW src) Performs a bulk copy from given source segment to this segment.MemorySegment.fill
(byte value) Fills a value into this memory segment.VaList.nextVarg
(GroupLayoutPREVIEW layout, SegmentAllocatorPREVIEW allocator) Reads the next value as aMemorySegment
, and advances this variable argument list's position.static MemorySegmentPREVIEW
MemorySegment.ofAddress
(MemoryAddressPREVIEW address, long bytesSize, MemorySessionPREVIEW session) Creates a native memory segment with the given size, base address, and memory session.static MemorySegmentPREVIEW
MemorySegment.ofArray
(byte[] arr) Creates an array memory segment that models the memory associated with the given heap-allocated byte array.static MemorySegmentPREVIEW
MemorySegment.ofArray
(char[] arr) Creates an array memory segment that models the memory associated with the given heap-allocated char array.static MemorySegmentPREVIEW
MemorySegment.ofArray
(double[] arr) Creates an array memory segment that models the memory associated with the given heap-allocated double array.static MemorySegmentPREVIEW
MemorySegment.ofArray
(float[] arr) Creates an array memory segment that models the memory associated with the given heap-allocated float array.static MemorySegmentPREVIEW
MemorySegment.ofArray
(int[] arr) Creates an array memory segment that models the memory associated with the given heap-allocated int array.static MemorySegmentPREVIEW
MemorySegment.ofArray
(long[] arr) Creates an array memory segment that models the memory associated with the given heap-allocated long array.static MemorySegmentPREVIEW
MemorySegment.ofArray
(short[] arr) Creates an array memory segment that models the memory associated with the given heap-allocated short array.static MemorySegmentPREVIEW
Creates a buffer memory segment that models the memory associated with the givenBuffer
instance.Linker.upcallStub
(MethodHandle target, FunctionDescriptorPREVIEW function, MemorySessionPREVIEW session) Creates a stub which can be passed to other foreign functions as a function pointer, with the given memory session.Modifier and TypeMethodDescriptionMemorySegment.asOverlappingSlice
(MemorySegmentPREVIEW other) Returns a slice of this segment that is the overlap between this and the provided segment.MemorySegment.elements
(MemoryLayoutPREVIEW elementLayout) Returns a sequentialStream
over disjoint slices (whose size matches that of the specified layout) in this segment.Returns the address of the symbol with the given name.MemorySegment.spliterator
(MemoryLayoutPREVIEW elementLayout) Returns a spliterator for this memory segment.Modifier and TypeMethodDescriptionVaList.Builder.addVarg
(GroupLayoutPREVIEW layout, MemorySegmentPREVIEW value) Writes aMemorySegment
value, with the given layout, to the variable argument list being constructed.MemorySegment.asOverlappingSlice
(MemorySegmentPREVIEW other) Returns a slice of this segment that is the overlap between this and the provided segment.static void
MemorySegment.copy
(MemorySegmentPREVIEW srcSegment, long srcOffset, MemorySegmentPREVIEW dstSegment, long dstOffset, long bytes) Performs a bulk copy from source segment to destination segment.static void
MemorySegment.copy
(MemorySegmentPREVIEW srcSegment, ValueLayoutPREVIEW srcElementLayout, long srcOffset, MemorySegmentPREVIEW dstSegment, ValueLayoutPREVIEW dstElementLayout, long dstOffset, long elementCount) Performs a bulk copy from source segment to destination segment.static void
MemorySegment.copy
(MemorySegmentPREVIEW srcSegment, ValueLayoutPREVIEW srcLayout, long srcOffset, Object dstArray, int dstIndex, int elementCount) Copies a number of elements from a source memory segment to a destination array.static void
MemorySegment.copy
(Object srcArray, int srcIndex, MemorySegmentPREVIEW dstSegment, ValueLayoutPREVIEW dstLayout, long dstOffset, int elementCount) Copies a number of elements from a source array to a destination memory segment.default MemorySegmentPREVIEW
MemorySegment.copyFrom
(MemorySegmentPREVIEW src) Performs a bulk copy from given source segment to this segment.long
MemorySegment.mismatch
(MemorySegmentPREVIEW other) Finds and returns the offset, in bytes, of the first mismatch between this segment and the given other segment.static SegmentAllocatorPREVIEW
SegmentAllocator.prefixAllocator
(MemorySegmentPREVIEW segment) Returns a segment allocator which responds to allocation requests by recycling a single segment.long
MemorySegment.segmentOffset
(MemorySegmentPREVIEW other) Returns the offset, in bytes, of the provided segment, relative to this segment. -
Uses of MemorySegmentPREVIEW in java.nio.channels
Modifier and TypeMethodDescriptionFileChannel.map
(FileChannel.MapMode mode, long offset, long size, MemorySessionPREVIEW session) Preview.Maps a region of this channel's file into a new mapped memory segment, with the given offset, size and memory session.