MemoryLayouts (Java SE 15 & JDK 15)
Description: declaration: module: jdk.incubator.foreign, package: jdk.incubator.foreign, class: MemoryLayouts
Keywords: jdk.incubator.foreign.MemoryLayouts class

Module jdk.incubator.foreign
Package jdk.incubator.foreign

# Class MemoryLayouts

java.lang.Object
jdk.incubator.foreign.MemoryLayouts

    public final class MemoryLayouts
    extends Object

This class defines useful layout constants. Some of the constants defined in this class are explicit in both size and byte order (see `BITS_64_BE`), and can therefore be used to explicitly and unambiguously specify the contents of a memory segment. Other constants make implicit byte order assumptions (see `JAVA_INT`); as such, these constants make it easy to work with other serialization-centric APIs, such as `ByteBuffer`.

- ## Field Summary

  Fields
  Modifier and Type | Field | Description
  --- | --- | ---
  `static ValueLayout` | `BITS_16_BE` | A value layout constant with size of two bytes, and byte order set to `ByteOrder.BIG_ENDIAN`.
  `static ValueLayout` | `BITS_16_LE` | A value layout constant with size of two bytes, and byte order set to `ByteOrder.LITTLE_ENDIAN`.
  `static ValueLayout` | `BITS_32_BE` | A value layout constant with size of four bytes, and byte order set to `ByteOrder.BIG_ENDIAN`.
  `static ValueLayout` | `BITS_32_LE` | A value layout constant with size of four bytes, and byte order set to `ByteOrder.LITTLE_ENDIAN`.
  `static ValueLayout` | `BITS_64_BE` | A value layout constant with size of eight bytes, and byte order set to `ByteOrder.BIG_ENDIAN`.
  `static ValueLayout` | `BITS_64_LE` | A value layout constant with size of eight bytes, and byte order set to `ByteOrder.LITTLE_ENDIAN`.
  `static ValueLayout` | `BITS_8_BE` | A value layout constant with size of one byte, and byte order set to `ByteOrder.BIG_ENDIAN`.
  `static ValueLayout` | `BITS_8_LE` | A value layout constant with size of one byte, and byte order set to `ByteOrder.LITTLE_ENDIAN`.
  `static ValueLayout` | `JAVA_BYTE` | A value layout constant whose size is the same as that of a Java `byte`, and byte order set to `ByteOrder.nativeOrder()`.
  `static ValueLayout` | `JAVA_CHAR` | A value layout constant whose size is the same as that of a Java `char`, and byte order set to `ByteOrder.nativeOrder()`.
  `static ValueLayout` | `JAVA_DOUBLE` | A value layout constant whose size is the same as that of a Java `double`, and byte order set to `ByteOrder.nativeOrder()`.
  `static ValueLayout` | `JAVA_FLOAT` | A value layout constant whose size is the same as that of a Java `float`, and byte order set to `ByteOrder.nativeOrder()`.
  `static ValueLayout` | `JAVA_INT` | A value layout constant whose size is the same as that of a Java `int`, and byte order set to `ByteOrder.nativeOrder()`.
  `static ValueLayout` | `JAVA_LONG` | A value layout constant whose size is the same as that of a Java `long`, and byte order set to `ByteOrder.nativeOrder()`.
  `static ValueLayout` | `JAVA_SHORT` | A value layout constant whose size is the same as that of a Java `short`, and byte order set to `ByteOrder.nativeOrder()`.
  `static MemoryLayout` | `PAD_16` | A padding layout constant with size of two bytes.
  `static MemoryLayout` | `PAD_32` | A padding layout constant with size of four bytes.
  `static MemoryLayout` | `PAD_64` | A padding layout constant with size of eight bytes.
  `static MemoryLayout` | `PAD_8` | A padding layout constant with size of one byte.

- ## Method Summary

  ### Methods declared in class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### BITS_8_LE

    public static final ValueLayout BITS_8_LE
    A value layout constant with size of one byte, and byte order set to `ByteOrder.LITTLE_ENDIAN`.

  - ### BITS_16_LE

    public static final ValueLayout BITS_16_LE
    A value layout constant with size of two bytes, and byte order set to `ByteOrder.LITTLE_ENDIAN`.

  - ### BITS_32_LE

    public static final ValueLayout BITS_32_LE
    A value layout constant with size of four bytes, and byte order set to `ByteOrder.LITTLE_ENDIAN`.

  - ### BITS_64_LE

    public static final ValueLayout BITS_64_LE
    A value layout constant with size of eight bytes, and byte order set to `ByteOrder.LITTLE_ENDIAN`.

  - ### BITS_8_BE

    public static final ValueLayout BITS_8_BE
    A value layout constant with size of one byte, and byte order set to `ByteOrder.BIG_ENDIAN`.

  - ### BITS_16_BE

    public static final ValueLayout BITS_16_BE
    A value layout constant with size of two bytes, and byte order set to `ByteOrder.BIG_ENDIAN`.

  - ### BITS_32_BE

    public static final ValueLayout BITS_32_BE
    A value layout constant with size of four bytes, and byte order set to `ByteOrder.BIG_ENDIAN`.

  - ### BITS_64_BE

    public static final ValueLayout BITS_64_BE
    A value layout constant with size of eight bytes, and byte order set to `ByteOrder.BIG_ENDIAN`.

  - ### PAD_8

    public static final MemoryLayout PAD_8
    A padding layout constant with size of one byte.

  - ### PAD_16

    public static final MemoryLayout PAD_16
    A padding layout constant with size of two bytes.

  - ### PAD_32

    public static final MemoryLayout PAD_32
    A padding layout constant with size of four bytes.

  - ### PAD_64

    public static final MemoryLayout PAD_64
    A padding layout constant with size of eight bytes.

  - ### JAVA_BYTE

    public static final ValueLayout JAVA_BYTE
    A value layout constant whose size is the same as that of a Java `byte`, and byte order set to `ByteOrder.nativeOrder()`.

  - ### JAVA_CHAR

    public static final ValueLayout JAVA_CHAR
    A value layout constant whose size is the same as that of a Java `char`, and byte order set to `ByteOrder.nativeOrder()`.

  - ### JAVA_SHORT

    public static final ValueLayout JAVA_SHORT
    A value layout constant whose size is the same as that of a Java `short`, and byte order set to `ByteOrder.nativeOrder()`.

  - ### JAVA_INT

    public static final ValueLayout JAVA_INT
    A value layout constant whose size is the same as that of a Java `int`, and byte order set to `ByteOrder.nativeOrder()`.

  - ### JAVA_LONG

    public static final ValueLayout JAVA_LONG
    A value layout constant whose size is the same as that of a Java `long`, and byte order set to `ByteOrder.nativeOrder()`.

  - ### JAVA_FLOAT

    public static final ValueLayout JAVA_FLOAT
    A value layout constant whose size is the same as that of a Java `float`, and byte order set to `ByteOrder.nativeOrder()`.

  - ### JAVA_DOUBLE

    public static final ValueLayout JAVA_DOUBLE
    A value layout constant whose size is the same as that of a Java `double`, and byte order set to `ByteOrder.nativeOrder()`.