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
Modifier and Type | Field | Description |
---|---|---|
static final ValueLayout |
ADDRESS |
A value layout constant whose size is the same as that of a machine address (e.g. |
static final ValueLayout |
BITS_16_BE |
A value layout constant with size of two bytes, and byte order set to ByteOrder.BIG_ENDIAN . |
static final ValueLayout |
BITS_16_LE |
A value layout constant with size of two bytes, and byte order set to ByteOrder.LITTLE_ENDIAN . |
static final ValueLayout |
BITS_32_BE |
A value layout constant with size of four bytes, and byte order set to ByteOrder.BIG_ENDIAN . |
static final ValueLayout |
BITS_32_LE |
A value layout constant with size of four bytes, and byte order set to ByteOrder.LITTLE_ENDIAN . |
static final ValueLayout |
BITS_64_BE |
A value layout constant with size of eight bytes, and byte order set to ByteOrder.BIG_ENDIAN . |
static final ValueLayout |
BITS_64_LE |
A value layout constant with size of eight bytes, and byte order set to ByteOrder.LITTLE_ENDIAN . |
static final ValueLayout |
BITS_8_BE |
A value layout constant with size of one byte, and byte order set to ByteOrder.BIG_ENDIAN . |
static final ValueLayout |
BITS_8_LE |
A value layout constant with size of one byte, and byte order set to ByteOrder.LITTLE_ENDIAN . |
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() . |
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() . |
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() . |
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() . |
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() . |
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() . |
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() . |
static final MemoryLayout |
PAD_16 |
A padding layout constant with size of two bytes. |
static final MemoryLayout |
PAD_32 |
A padding layout constant with size of four bytes. |
static final MemoryLayout |
PAD_64 |
A padding layout constant with size of eight bytes. |
static final MemoryLayout |
PAD_8 |
A padding layout constant with size of one byte. |
Method Summary
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.
ADDRESS
public static final ValueLayout ADDRESS
A value layout constant whose size is the same as that of a machine address (e.g.
size_t
), and byte order set to ByteOrder.nativeOrder()
.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()
. The alignment of this layout (see MemoryLayout.byteAlignment()
is platform-dependent, so that the following invariant holds: MemoryLayouts.JAVA_LONG.byteAlignment() == MemoryLayouts.ADDRESS.byteSize();
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()
. The alignment of this layout (see MemoryLayout.byteAlignment()
is platform-dependent, so that the following invariant holds: MemoryLayouts.JAVA_DOUBLE.byteAlignment() == MemoryLayouts.ADDRESS.byteSize();
© 1993, 2021, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from Debian's OpenJDK Development Kit package.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Various third party code in OpenJDK is licensed under different licenses (see Debian package).
Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
https://docs.oracle.com/en/java/javase/17/docs/api/jdk.incubator.foreign/jdk/incubator/foreign/MemoryLayouts.html