# Uses of Interface
java.lang.foreign.MemoryLayout

Packages that use MemoryLayout
Package
Description
java.lang.foreign
Provides low-level access to memory and functions outside the Java runtime.

- ## Uses of MemoryLayout in java.lang.foreign

  Subinterfaces of MemoryLayout in java.lang.foreign
  Modifier and Type
  Interface
  Description
  `interface`
  `AddressLayout`
  A value layout used to model the address of some region of memory.
  `interface`
  `GroupLayout`
  A compound layout that is an aggregation of multiple, heterogeneous member layouts.
  `interface`
  `PaddingLayout`
  A padding layout.
  `interface`
  `SequenceLayout`
  A compound layout that denotes a homogeneous repetition of a given element layout.
  `interface`
  `StructLayout`
  A group layout whose member layouts are laid out one after the other.
  `interface`
  `UnionLayout`
  A group layout whose member layouts are laid out at the same starting offset.
  `interface`
  `ValueLayout`
  A layout that models values of basic data types.
  `static interface`
  `ValueLayout.OfBoolean`
  A value layout whose carrier is `boolean.class`.
  `static interface`
  `ValueLayout.OfByte`
  A value layout whose carrier is `byte.class`.
  `static interface`
  `ValueLayout.OfChar`
  A value layout whose carrier is `char.class`.
  `static interface`
  `ValueLayout.OfDouble`
  A value layout whose carrier is `double.class`.
  `static interface`
  `ValueLayout.OfFloat`
  A value layout whose carrier is `float.class`.
  `static interface`
  `ValueLayout.OfInt`
  A value layout whose carrier is `int.class`.
  `static interface`
  `ValueLayout.OfLong`
  A value layout whose carrier is `long.class`.
  `static interface`
  `ValueLayout.OfShort`
  A value layout whose carrier is `short.class`.
  Methods in java.lang.foreign that return MemoryLayout
  Modifier and Type
  Method
  Description
  `MemoryLayout`
  SequenceLayout.`elementLayout()`
  Returns the element layout of this sequence layout.
  `MemoryLayout`
  MemoryLayout.`select(MemoryLayout.PathElement... elements)`
  Returns the layout selected from the provided path, where the initial layout in the path is this layout.
  `MemoryLayout`
  MemoryLayout.`withByteAlignment(long byteAlignment)`
  Returns a memory layout with the same characteristics as this layout, but with the given alignment constraint (in bytes).
  `MemoryLayout`
  MemoryLayout.`withName(String name)`
  Returns a memory layout with the same characteristics as this layout, but with the given name.
  `MemoryLayout`
  MemoryLayout.`withoutName()`
  Returns a memory layout with the same characteristics as this layout, but with no name.
  Methods in java.lang.foreign that return types with arguments of type MemoryLayout
  Modifier and Type
  Method
  Description
  `List<MemoryLayout>`
  FunctionDescriptor.`argumentLayouts()`
  Returns the argument layouts of this function descriptor (as an unmodifiable list).
  `Map<String, MemoryLayout>`
  Linker.`canonicalLayouts()`
  Returns an unmodifiable mapping between the names of data types used by the ABI implemented by this linker and their canonical layouts.
  `List<MemoryLayout>`
  GroupLayout.`memberLayouts()`
  Returns the member layouts of this group layout.
  `Optional<MemoryLayout>`
  FunctionDescriptor.`returnLayout()`
  Returns the return layout (if any) of this function descriptor.
  `Optional<MemoryLayout>`
  AddressLayout.`targetLayout()`
  Returns the target layout associated with this address layout (if any).
  Methods in java.lang.foreign with parameters of type MemoryLayout
  Modifier and Type
  Method
  Description
  `default MemorySegment`
  SegmentAllocator.`allocate(MemoryLayout layout)`
  Returns a new memory segment with the given layout.
  `default MemorySegment`
  SegmentAllocator.`allocate(MemoryLayout elementLayout, long count)`
  Returns a new memory segment with the given `elementLayout` and `count`.
  `FunctionDescriptor`
  FunctionDescriptor.`appendArgumentLayouts(MemoryLayout... addedLayouts)`
  Returns a function descriptor with the given argument layouts appended to the argument layouts of this function descriptor.
  `MemorySegment`
  MemorySegment.`asSlice(long offset, MemoryLayout layout)`
  Returns a slice of this memory segment with the given layout, at the given offset.
  `FunctionDescriptor`
  FunctionDescriptor.`changeReturnLayout(MemoryLayout newReturn)`
  Returns a function descriptor with the provided return layout.
  `Stream<MemorySegment>`
  MemorySegment.`elements(MemoryLayout elementLayout)`
  Returns a sequential `Stream` over disjoint slices (whose size matches that of the specified layout) in this segment.
  `FunctionDescriptor`
  FunctionDescriptor.`insertArgumentLayouts(int index, MemoryLayout... addedLayouts)`
  Returns a function descriptor with the given argument layouts inserted at the given index, into the argument layout array of this function descriptor.
  `static FunctionDescriptor`
  FunctionDescriptor.`of(MemoryLayout resLayout, MemoryLayout... argLayouts)`
  Creates a function descriptor with the given return and argument layouts.
  `static FunctionDescriptor`
  FunctionDescriptor.`ofVoid(MemoryLayout... argLayouts)`
  Creates a function descriptor with the given argument layouts and no return layout.
  `static SequenceLayout`
  MemoryLayout.`sequenceLayout(long elementCount, MemoryLayout elementLayout)`
  Creates a sequence layout with the given element layout and element count.
  `Spliterator<MemorySegment>`
  MemorySegment.`spliterator(MemoryLayout elementLayout)`
  Returns a spliterator for this memory segment.
  `static StructLayout`
  MemoryLayout.`structLayout(MemoryLayout... elements)`
  Creates a struct layout with the given member layouts.
  `static UnionLayout`
  MemoryLayout.`unionLayout(MemoryLayout... elements)`
  Creates a union layout with the given member layouts.
  `AddressLayout`
  AddressLayout.`withTargetLayout(MemoryLayout layout)`
  Restricted.
  Returns an address layout with the same carrier, alignment constraint, name and order as this address layout, but associated with the specified target layout.