# Uses of Interface
jdk.incubator.foreign.MemoryLayout

Packages that use MemoryLayout
Package
Description
jdk.incubator.foreign
Classes to support low-level and efficient foreign memory/function access, directly from Java.

## Uses of MemoryLayout in jdk.incubator.foreign

Classes in jdk.incubator.foreign that implement MemoryLayout
Modifier and Type
Class
Description
`class`
`GroupLayout`
A group layout is used to combine together multiple member layouts.
`class`
`SequenceLayout`
A sequence layout.
`class`
`ValueLayout`
A value layout.
Fields in jdk.incubator.foreign declared as MemoryLayout
Modifier and Type
Field
Description
`static MemoryLayout`
CLinker.`C_VA_LIST`
The layout for the `va_list` C type
`static MemoryLayout`
MemoryLayouts.`PAD_16`
A padding layout constant with size of two bytes.
`static MemoryLayout`
MemoryLayouts.`PAD_32`
A padding layout constant with size of four bytes.
`static MemoryLayout`
MemoryLayouts.`PAD_64`
A padding layout constant with size of eight bytes.
`static MemoryLayout`
MemoryLayouts.`PAD_8`
A padding layout constant with size of one byte.
Methods in jdk.incubator.foreign with type parameters of type MemoryLayout
Modifier and Type
Method
Description
`static <T extends MemoryLayout>
T`
CLinker.`asVarArg​(T layout)`
Returns a memory layout that is suitable to use as the layout for variadic arguments in a specialized function descriptor.
Methods in jdk.incubator.foreign that return MemoryLayout
Modifier and Type
Method
Description
`MemoryLayout`
SequenceLayout.`elementLayout()`
Returns the element layout associated with this sequence layout.
`default MemoryLayout`
MemoryLayout.`map​(UnaryOperator<MemoryLayout> op, MemoryLayout.PathElement... elements)`
Creates a transformed copy of this layout where a selected layout, from a path rooted in this layout, is replaced with the result of applying the given operation.
`static MemoryLayout`
MemoryLayout.`ofPaddingBits​(long size)`
Create a new padding layout with given size.
`default MemoryLayout`
MemoryLayout.`select​(MemoryLayout.PathElement... elements)`
Selects the layout from a path rooted in this layout.
`MemoryLayout`
MemoryLayout.`withAttribute​(String name, Constable value)`
Returns a new memory layout which features the same attributes as this layout, plus the newly specified attribute.
`MemoryLayout`
MemoryLayout.`withBitAlignment​(long bitAlignment)`
Creates a new layout which features the desired alignment constraint.
`MemoryLayout`
MemoryLayout.`withName​(String name)`
Creates a new layout which features the desired layout name.
Methods in jdk.incubator.foreign that return types with arguments of type MemoryLayout
Modifier and Type
Method
Description
`List<MemoryLayout>`
FunctionDescriptor.`argumentLayouts()`
Returns the argument layouts associated with this function.
`Optional<? extends DynamicConstantDesc<? extends MemoryLayout>>`
MemoryLayout.`describeConstable()`
Returns an `Optional` containing the nominal descriptor for this layout, if one can be constructed, or an empty `Optional` if one cannot be constructed.
`List<MemoryLayout>`
GroupLayout.`memberLayouts()`
Returns the member layouts associated with this group.
`Optional<MemoryLayout>`
FunctionDescriptor.`returnLayout()`
Returns the return layout associated with this function.
Methods in jdk.incubator.foreign with parameters of type MemoryLayout
Modifier and Type
Method
Description
`default MemorySegment`
NativeScope.`allocate​(MemoryLayout layout)`
Allocate a block of memory in this native scope with given layout.
`default MemorySegment`
NativeScope.`allocateArray​(MemoryLayout elementLayout, long count)`
Allocate a block of memory corresponding to an array with given element layout and size.
`static MemorySegment`
MemorySegment.`allocateNative​(MemoryLayout layout)`
Creates a new confined native memory segment that models a newly allocated block of off-heap memory with given layout.
`static FunctionDescriptor`
FunctionDescriptor.`of​(MemoryLayout resLayout, MemoryLayout... argLayouts)`
Create a function descriptor with given return and argument layouts.
`static SequenceLayout`
MemoryLayout.`ofSequence​(long elementCount, MemoryLayout elementLayout)`
Create a new sequence layout with given element layout and element count.
`static SequenceLayout`
MemoryLayout.`ofSequence​(MemoryLayout elementLayout)`
Create a new sequence layout, with unbounded element count and given element layout.
`static GroupLayout`
MemoryLayout.`ofStruct​(MemoryLayout... elements)`
Create a new struct group layout with given member layouts.
`static GroupLayout`
MemoryLayout.`ofUnion​(MemoryLayout... elements)`
Create a new union group layout with given member layouts.
`static FunctionDescriptor`
FunctionDescriptor.`ofVoid​(MemoryLayout... argLayouts)`
Create a function descriptor with given argument layouts and no return layout.
`void`
CLinker.VaList.`skip​(MemoryLayout... layouts)`
Skips a number of elements with the given memory layouts, and advances this va list's position.
`MemoryAddress`
CLinker.VaList.`vargAsAddress​(MemoryLayout layout)`
Reads the next value as a `MemoryAddress` and advances this va list's position.
`double`
CLinker.VaList.`vargAsDouble​(MemoryLayout layout)`
Reads the next value as a `double` and advances this va list's position.
`int`
CLinker.VaList.`vargAsInt​(MemoryLayout layout)`
Reads the next value as an `int` and advances this va list's position.
`long`
CLinker.VaList.`vargAsLong​(MemoryLayout layout)`
Reads the next value as a `long` and advances this va list's position.
`MemorySegment`
CLinker.VaList.`vargAsSegment​(MemoryLayout layout)`
Reads the next value as a `MemorySegment`, and advances this va list's position.
`MemorySegment`
CLinker.VaList.`vargAsSegment​(MemoryLayout layout, NativeScope scope)`
Reads the next value as a `MemorySegment`, and advances this va list's position.
`FunctionDescriptor`
FunctionDescriptor.`withAppendedArgumentLayouts​(MemoryLayout... addedLayouts)`
Create a new function descriptor with the given argument layouts appended to the argument layout array of this function descriptor.
`FunctionDescriptor`
FunctionDescriptor.`withReturnLayout​(MemoryLayout newReturn)`
Create a new function descriptor with the given memory layout as the new return layout.
Method parameters in jdk.incubator.foreign with type arguments of type MemoryLayout
Modifier and Type
Method
Description
`default MemoryLayout`
MemoryLayout.`map​(UnaryOperator<MemoryLayout> op, MemoryLayout.PathElement... elements)`
Creates a transformed copy of this layout where a selected layout, from a path rooted in this layout, is replaced with the result of applying the given operation.