Uses of Interface
java.lang.foreign.MemorySegment
Packages that use MemorySegmentPREVIEW
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.
Incubating Feature. Will be removed in a future release.
-
Uses of MemorySegmentPREVIEW in java.lang.foreignPREVIEW
Fields in java.lang.foreignPREVIEW declared as MemorySegmentPREVIEWModifier and TypeFieldDescriptionstatic final MemorySegmentPREVIEWMemorySegment.NULLA zero-length native segment modelling theNULLaddress.Methods in java.lang.foreignPREVIEW that return MemorySegmentPREVIEWModifier and TypeMethodDescriptiondefault MemorySegmentPREVIEWArena.allocate(long byteSize, long byteAlignment) Returns a native memory segment with the given size (in bytes) and alignment constraint (in bytes).default MemorySegmentPREVIEWSegmentAllocator.allocate(long byteSize) Returns a new memory segment with the givenbyteSize.SegmentAllocator.allocate(long byteSize, long byteAlignment) Returns a new memory segment with the givenbyteSizeandbyteAlignment.default MemorySegmentPREVIEWSegmentAllocator.allocate(AddressLayoutPREVIEW layout, MemorySegmentPREVIEW value) Returns a new memory segment initialized with the address of the providedvalueas specified by the providedlayout(i.e. byte ordering, alignment and size).default MemorySegmentPREVIEWSegmentAllocator.allocate(MemoryLayoutPREVIEW layout) Returns a new memory segment with the given layout.default MemorySegmentPREVIEWSegmentAllocator.allocate(ValueLayout.OfBytePREVIEW layout, byte value) Returns a new memory segment initialized with the providedbytevalueas specified by the providedlayout(i.e. byte ordering, alignment and size).default MemorySegmentPREVIEWSegmentAllocator.allocate(ValueLayout.OfCharPREVIEW layout, char value) Returns a new memory segment initialized with the providedcharvalueas specified by the providedlayout(i.e. byte ordering, alignment and size).default MemorySegmentPREVIEWSegmentAllocator.allocate(ValueLayout.OfDoublePREVIEW layout, double value) Returns a new memory segment initialized with the provideddoublevalueas specified by the providedlayout(i.e. byte ordering, alignment and size).default MemorySegmentPREVIEWSegmentAllocator.allocate(ValueLayout.OfFloatPREVIEW layout, float value) Returns a new memory segment initialized with the providedfloatvalueas specified by the providedlayout(i.e. byte ordering, alignment and size).default MemorySegmentPREVIEWSegmentAllocator.allocate(ValueLayout.OfIntPREVIEW layout, int value) Returns a new memory segment initialized with the providedintvalueas specified by the providedlayout(i.e. byte ordering, alignment and size).default MemorySegmentPREVIEWSegmentAllocator.allocate(ValueLayout.OfLongPREVIEW layout, long value) Returns a new memory segment initialized with the providedlongvalueas specified by the providedlayout(i.e. byte ordering, alignment and size).default MemorySegmentPREVIEWSegmentAllocator.allocate(ValueLayout.OfShortPREVIEW layout, short value) Returns a new memory segment initialized with the providedshortvalueas specified by the providedlayout(i.e. byte ordering, alignment and size).default MemorySegmentPREVIEWSegmentAllocator.allocateArray(MemoryLayoutPREVIEW elementLayout, long count) Returns a new memory segment with the givenelementLayoutandcount.default MemorySegmentPREVIEWSegmentAllocator.allocateArray(ValueLayout.OfBytePREVIEW elementLayout, byte... elements) Returns a new memory segment with a byteSize()PREVIEW ofE*layout.byteSize()initialized with the providedEbyteelementsas specified by the providedlayout(i.e. byte ordering, alignment and size).default MemorySegmentPREVIEWSegmentAllocator.allocateArray(ValueLayout.OfCharPREVIEW elementLayout, char... elements) Returns a new memory segment with a byteSize()PREVIEW ofE*layout.byteSize()initialized with the providedEcharelementsas specified by the providedlayout(i.e. byte ordering, alignment and size).default MemorySegmentPREVIEWSegmentAllocator.allocateArray(ValueLayout.OfDoublePREVIEW elementLayout, double... elements) Returns a new memory segment with a byteSize()PREVIEW ofE*layout.byteSize()initialized with the providedEdoubleelementsas specified by the providedlayout(i.e. byte ordering, alignment and size).default MemorySegmentPREVIEWSegmentAllocator.allocateArray(ValueLayout.OfFloatPREVIEW elementLayout, float... elements) Returns a new memory segment with a byteSize()PREVIEW ofE*layout.byteSize()initialized with the providedEfloatelementsas specified by the providedlayout(i.e. byte ordering, alignment and size).default MemorySegmentPREVIEWSegmentAllocator.allocateArray(ValueLayout.OfIntPREVIEW elementLayout, int... elements) Returns a new memory segment with a byteSize()PREVIEW ofE*layout.byteSize()initialized with the providedEintelementsas specified by the providedlayout(i.e. byte ordering, alignment and size).default MemorySegmentPREVIEWSegmentAllocator.allocateArray(ValueLayout.OfLongPREVIEW elementLayout, long... elements) Returns a new memory segment with a byteSize()PREVIEW ofE*layout.byteSize()initialized with the providedElongelementsas specified by the providedlayout(i.e. byte ordering, alignment and size).default MemorySegmentPREVIEWSegmentAllocator.allocateArray(ValueLayout.OfShortPREVIEW elementLayout, short... elements) Returns a new memory segment with a byteSize()PREVIEW ofE*layout.byteSize()initialized with the providedEshortelementsas specified by the providedlayout(i.e. byte ordering, alignment and size).default MemorySegmentPREVIEWSegmentAllocator.allocateUtf8String(String str) Returns a new memory segment with a Java string converted into a UTF-8 encoded, null-terminated C string.MemorySegment.asReadOnly()Returns a read-only view of this segment.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.MemorySegment.asSlice(long offset, long newSize, long byteAlignment) Returns a slice of this memory segment, at the given offset, with the provided alignment constraint.default MemorySegmentPREVIEWMemorySegment.asSlice(long offset, MemoryLayoutPREVIEW layout) Returns a slice of this memory segment with the given layout, at the given offset.default MemorySegmentPREVIEWMemorySegment.copyFrom(MemorySegmentPREVIEW src) Performs a bulk copy from given source segment to this segment.MemorySegment.fill(byte value) Fills the contents of this memory segment with the given value.default MemorySegmentPREVIEWMemorySegment.get(AddressLayoutPREVIEW layout, long offset) Reads an address from this segment at the given offset, with the given layout.default MemorySegmentPREVIEWMemorySegment.getAtIndex(AddressLayoutPREVIEW layout, long index) Reads an address from this segment at the given at the given index, scaled by the given layout size.static MemorySegmentPREVIEWMemorySegment.ofAddress(long address) Creates a zero-length native segment from the given address valuePREVIEW.static MemorySegmentPREVIEWMemorySegment.ofArray(byte[] byteArray) Creates a heap segment backed by the on-heap region of memory that holds the given byte array.static MemorySegmentPREVIEWMemorySegment.ofArray(char[] charArray) Creates a heap segment backed by the on-heap region of memory that holds the given char array.static MemorySegmentPREVIEWMemorySegment.ofArray(double[] doubleArray) Creates a heap segment backed by the on-heap region of memory that holds the given double array.static MemorySegmentPREVIEWMemorySegment.ofArray(float[] floatArray) Creates a heap segment backed by the on-heap region of memory that holds the given float array.static MemorySegmentPREVIEWMemorySegment.ofArray(int[] intArray) Creates a heap segment backed by the on-heap region of memory that holds the given int array.static MemorySegmentPREVIEWMemorySegment.ofArray(long[] longArray) Creates a heap segment backed by the on-heap region of memory that holds the given long array.static MemorySegmentPREVIEWMemorySegment.ofArray(short[] shortArray) Creates a heap segment backed by the on-heap region of memory that holds the given short array.static MemorySegmentPREVIEWCreates a memory segment that is backed by the same region of memory that backs the givenBufferinstance.MemorySegment.reinterpret(long newSize) Returns a new memory segment that has the same address and scope as this segment, but with the provided size.MemorySegment.reinterpret(long newSize, ArenaPREVIEW arena, Consumer<MemorySegmentPREVIEW> cleanup) Returns a new segment with the same address as this segment, but with the provided size and scope.MemorySegment.reinterpret(ArenaPREVIEW arena, Consumer<MemorySegmentPREVIEW> cleanup) Returns a new memory segment with the same address and size as this segment, but with the provided scope.Linker.upcallStub(MethodHandle target, FunctionDescriptorPREVIEW function, ArenaPREVIEW arena, Linker.OptionPREVIEW... options) Creates an upcall stub which can be passed to other foreign functions as a function pointer, associated with the given arena.Methods in java.lang.foreignPREVIEW that return types with arguments of type MemorySegmentPREVIEWModifier 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 sequentialStreamover 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.Methods in java.lang.foreignPREVIEW with parameters of type MemorySegmentPREVIEWModifier and TypeMethodDescriptiondefault MemorySegmentPREVIEWSegmentAllocator.allocate(AddressLayoutPREVIEW layout, MemorySegmentPREVIEW value) Returns a new memory segment initialized with the address of the providedvalueas specified by the providedlayout(i.e. byte ordering, alignment and size).MemorySegment.asOverlappingSlice(MemorySegmentPREVIEW other) Returns a slice of this segment that is the overlap between this and the provided segment.static voidMemorySegment.copy(MemorySegmentPREVIEW srcSegment, long srcOffset, MemorySegmentPREVIEW dstSegment, long dstOffset, long bytes) Performs a bulk copy from source segment to destination segment.static voidMemorySegment.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 voidMemorySegment.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 voidMemorySegment.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 MemorySegmentPREVIEWMemorySegment.copyFrom(MemorySegmentPREVIEW src) Performs a bulk copy from given source segment to this segment.Linker.downcallHandle(MemorySegmentPREVIEW address, FunctionDescriptorPREVIEW function, Linker.OptionPREVIEW... options) Creates a method handle which is used to call a foreign function with the given signature and address.default longMemorySegment.mismatch(MemorySegmentPREVIEW other) Finds and returns the offset, in bytes, of the first mismatch between this segment and the given other segment.static longMemorySegment.mismatch(MemorySegmentPREVIEW srcSegment, long srcFromOffset, long srcToOffset, MemorySegmentPREVIEW dstSegment, long dstFromOffset, long dstToOffset) Finds and returns the relative offset, in bytes, of the first mismatch between the source and the destination segments.static SegmentAllocatorPREVIEWSegmentAllocator.prefixAllocator(MemorySegmentPREVIEW segment) Returns a segment allocator which responds to allocation requests by recycling a single segment.longMemorySegment.segmentOffset(MemorySegmentPREVIEW other) Returns the offset, in bytes, of the provided segment, relative to this segment.default voidMemorySegment.set(AddressLayoutPREVIEW layout, long offset, MemorySegmentPREVIEW value) Writes an address into this segment at the given offset, with the given layout.default voidMemorySegment.setAtIndex(AddressLayoutPREVIEW layout, long index, MemorySegmentPREVIEW value) Writes an address into this segment at the given index, scaled by the given layout size.static SegmentAllocatorPREVIEWSegmentAllocator.slicingAllocator(MemorySegmentPREVIEW segment) Returns a segment allocator which responds to allocation requests by returning consecutive slices obtained from the provided segment.Method parameters in java.lang.foreignPREVIEW with type arguments of type MemorySegmentPREVIEWModifier and TypeMethodDescriptionMemorySegment.reinterpret(long newSize, ArenaPREVIEW arena, Consumer<MemorySegmentPREVIEW> cleanup) Returns a new segment with the same address as this segment, but with the provided size and scope.MemorySegment.reinterpret(ArenaPREVIEW arena, Consumer<MemorySegmentPREVIEW> cleanup) Returns a new memory segment with the same address and size as this segment, but with the provided scope. -
Uses of MemorySegmentPREVIEW in java.nio.channels
Methods in java.nio.channels that return MemorySegmentPREVIEWModifier and TypeMethodDescriptionFileChannel.map(FileChannel.MapMode mode, long offset, long size, ArenaPREVIEW arena) Preview.Maps a region of this channel's file into a new mapped memory segment, with the given offset, size and arena. -
Uses of MemorySegmentPREVIEW in jdk.incubator.vector
Methods in jdk.incubator.vector with parameters of type MemorySegmentPREVIEWModifier and TypeMethodDescriptionstatic ByteVectorByteVector.fromMemorySegment(VectorSpecies<Byte> species, MemorySegmentPREVIEW ms, long offset, ByteOrder bo) Loads a vector from a memory segmentPREVIEW starting at an offset into the memory segment.static ByteVectorByteVector.fromMemorySegment(VectorSpecies<Byte> species, MemorySegmentPREVIEW ms, long offset, ByteOrder bo, VectorMask<Byte> m) Loads a vector from a memory segmentPREVIEW starting at an offset into the memory segment and using a mask.static DoubleVectorDoubleVector.fromMemorySegment(VectorSpecies<Double> species, MemorySegmentPREVIEW ms, long offset, ByteOrder bo) Loads a vector from a memory segmentPREVIEW starting at an offset into the memory segment.static DoubleVectorDoubleVector.fromMemorySegment(VectorSpecies<Double> species, MemorySegmentPREVIEW ms, long offset, ByteOrder bo, VectorMask<Double> m) Loads a vector from a memory segmentPREVIEW starting at an offset into the memory segment and using a mask.static FloatVectorFloatVector.fromMemorySegment(VectorSpecies<Float> species, MemorySegmentPREVIEW ms, long offset, ByteOrder bo) Loads a vector from a memory segmentPREVIEW starting at an offset into the memory segment.static FloatVectorFloatVector.fromMemorySegment(VectorSpecies<Float> species, MemorySegmentPREVIEW ms, long offset, ByteOrder bo, VectorMask<Float> m) Loads a vector from a memory segmentPREVIEW starting at an offset into the memory segment and using a mask.static IntVectorIntVector.fromMemorySegment(VectorSpecies<Integer> species, MemorySegmentPREVIEW ms, long offset, ByteOrder bo) Loads a vector from a memory segmentPREVIEW starting at an offset into the memory segment.static IntVectorIntVector.fromMemorySegment(VectorSpecies<Integer> species, MemorySegmentPREVIEW ms, long offset, ByteOrder bo, VectorMask<Integer> m) Loads a vector from a memory segmentPREVIEW starting at an offset into the memory segment and using a mask.static LongVectorLongVector.fromMemorySegment(VectorSpecies<Long> species, MemorySegmentPREVIEW ms, long offset, ByteOrder bo) Loads a vector from a memory segmentPREVIEW starting at an offset into the memory segment.static LongVectorLongVector.fromMemorySegment(VectorSpecies<Long> species, MemorySegmentPREVIEW ms, long offset, ByteOrder bo, VectorMask<Long> m) Loads a vector from a memory segmentPREVIEW starting at an offset into the memory segment and using a mask.static ShortVectorShortVector.fromMemorySegment(VectorSpecies<Short> species, MemorySegmentPREVIEW ms, long offset, ByteOrder bo) Loads a vector from a memory segmentPREVIEW starting at an offset into the memory segment.static ShortVectorShortVector.fromMemorySegment(VectorSpecies<Short> species, MemorySegmentPREVIEW ms, long offset, ByteOrder bo, VectorMask<Short> m) Loads a vector from a memory segmentPREVIEW starting at an offset into the memory segment and using a mask.VectorSpecies.fromMemorySegment(MemorySegmentPREVIEW ms, long offset, ByteOrder bo) Loads a vector of this species from a memory segmentPREVIEW starting at an offset into the memory segment.final voidByteVector.intoMemorySegment(MemorySegmentPREVIEW ms, long offset, ByteOrder bo) Stores this vector into a memory segmentPREVIEW starting at an offset using explicit byte order.final voidByteVector.intoMemorySegment(MemorySegmentPREVIEW ms, long offset, ByteOrder bo, VectorMask<Byte> m) Stores this vector into a memory segmentPREVIEW starting at an offset using explicit byte order and a mask.final voidDoubleVector.intoMemorySegment(MemorySegmentPREVIEW ms, long offset, ByteOrder bo) Stores this vector into a memory segmentPREVIEW starting at an offset using explicit byte order.final voidDoubleVector.intoMemorySegment(MemorySegmentPREVIEW ms, long offset, ByteOrder bo, VectorMask<Double> m) Stores this vector into a memory segmentPREVIEW starting at an offset using explicit byte order and a mask.final voidFloatVector.intoMemorySegment(MemorySegmentPREVIEW ms, long offset, ByteOrder bo) Stores this vector into a memory segmentPREVIEW starting at an offset using explicit byte order.final voidFloatVector.intoMemorySegment(MemorySegmentPREVIEW ms, long offset, ByteOrder bo, VectorMask<Float> m) Stores this vector into a memory segmentPREVIEW starting at an offset using explicit byte order and a mask.final voidIntVector.intoMemorySegment(MemorySegmentPREVIEW ms, long offset, ByteOrder bo) Stores this vector into a memory segmentPREVIEW starting at an offset using explicit byte order.final voidIntVector.intoMemorySegment(MemorySegmentPREVIEW ms, long offset, ByteOrder bo, VectorMask<Integer> m) Stores this vector into a memory segmentPREVIEW starting at an offset using explicit byte order and a mask.final voidLongVector.intoMemorySegment(MemorySegmentPREVIEW ms, long offset, ByteOrder bo) Stores this vector into a memory segmentPREVIEW starting at an offset using explicit byte order.final voidLongVector.intoMemorySegment(MemorySegmentPREVIEW ms, long offset, ByteOrder bo, VectorMask<Long> m) Stores this vector into a memory segmentPREVIEW starting at an offset using explicit byte order and a mask.final voidShortVector.intoMemorySegment(MemorySegmentPREVIEW ms, long offset, ByteOrder bo) Stores this vector into a memory segmentPREVIEW starting at an offset using explicit byte order.final voidShortVector.intoMemorySegment(MemorySegmentPREVIEW ms, long offset, ByteOrder bo, VectorMask<Short> m) Stores this vector into a memory segmentPREVIEW starting at an offset using explicit byte order and a mask.abstract voidVector.intoMemorySegment(MemorySegmentPREVIEW ms, long offset, ByteOrder bo) Stores this vector into a memory segmentPREVIEW starting at an offset using explicit byte order.abstract voidVector.intoMemorySegment(MemorySegmentPREVIEW ms, long offset, ByteOrder bo, VectorMask<E> m) Stores this vector into a memory segmentPREVIEW starting at an offset using explicit byte order and a mask.