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 TypeFieldDescriptionstatic ValueLayout
A value layout constant whose size is the same as that of a machine address (e.g.static ValueLayout
A value layout constant with size of two bytes, and byte order set toByteOrder.BIG_ENDIAN
.static ValueLayout
A value layout constant with size of two bytes, and byte order set toByteOrder.LITTLE_ENDIAN
.static ValueLayout
A value layout constant with size of four bytes, and byte order set toByteOrder.BIG_ENDIAN
.static ValueLayout
A value layout constant with size of four bytes, and byte order set toByteOrder.LITTLE_ENDIAN
.static ValueLayout
A value layout constant with size of eight bytes, and byte order set toByteOrder.BIG_ENDIAN
.static ValueLayout
A value layout constant with size of eight bytes, and byte order set toByteOrder.LITTLE_ENDIAN
.static ValueLayout
A value layout constant with size of one byte, and byte order set toByteOrder.BIG_ENDIAN
.static ValueLayout
A value layout constant with size of one byte, and byte order set toByteOrder.LITTLE_ENDIAN
.static ValueLayout
A value layout constant whose size is the same as that of a Javabyte
, and byte order set toByteOrder.nativeOrder()
.static ValueLayout
A value layout constant whose size is the same as that of a Javachar
, and byte order set toByteOrder.nativeOrder()
.static ValueLayout
A value layout constant whose size is the same as that of a Javadouble
, and byte order set toByteOrder.nativeOrder()
.static ValueLayout
A value layout constant whose size is the same as that of a Javafloat
, and byte order set toByteOrder.nativeOrder()
.static ValueLayout
A value layout constant whose size is the same as that of a Javaint
, and byte order set toByteOrder.nativeOrder()
.static ValueLayout
A value layout constant whose size is the same as that of a Javalong
, and byte order set toByteOrder.nativeOrder()
.static ValueLayout
A value layout constant whose size is the same as that of a Javashort
, and byte order set toByteOrder.nativeOrder()
.static MemoryLayout
A padding layout constant with size of two bytes.static MemoryLayout
A padding layout constant with size of four bytes.static MemoryLayout
A padding layout constant with size of eight bytes.static MemoryLayout
A padding layout constant with size of one byte. -
Method Summary
-
Field Details
-
BITS_8_LE
A value layout constant with size of one byte, and byte order set toByteOrder.LITTLE_ENDIAN
. -
BITS_16_LE
A value layout constant with size of two bytes, and byte order set toByteOrder.LITTLE_ENDIAN
. -
BITS_32_LE
A value layout constant with size of four bytes, and byte order set toByteOrder.LITTLE_ENDIAN
. -
BITS_64_LE
A value layout constant with size of eight bytes, and byte order set toByteOrder.LITTLE_ENDIAN
. -
BITS_8_BE
A value layout constant with size of one byte, and byte order set toByteOrder.BIG_ENDIAN
. -
BITS_16_BE
A value layout constant with size of two bytes, and byte order set toByteOrder.BIG_ENDIAN
. -
BITS_32_BE
A value layout constant with size of four bytes, and byte order set toByteOrder.BIG_ENDIAN
. -
BITS_64_BE
A value layout constant with size of eight bytes, and byte order set toByteOrder.BIG_ENDIAN
. -
PAD_8
A padding layout constant with size of one byte. -
PAD_16
A padding layout constant with size of two bytes. -
PAD_32
A padding layout constant with size of four bytes. -
PAD_64
A padding layout constant with size of eight bytes. -
ADDRESS
A value layout constant whose size is the same as that of a machine address (e.g.size_t
), and byte order set toByteOrder.nativeOrder()
. -
JAVA_BYTE
A value layout constant whose size is the same as that of a Javabyte
, and byte order set toByteOrder.nativeOrder()
. -
JAVA_CHAR
A value layout constant whose size is the same as that of a Javachar
, and byte order set toByteOrder.nativeOrder()
. -
JAVA_SHORT
A value layout constant whose size is the same as that of a Javashort
, and byte order set toByteOrder.nativeOrder()
. -
JAVA_INT
A value layout constant whose size is the same as that of a Javaint
, and byte order set toByteOrder.nativeOrder()
. -
JAVA_LONG
A value layout constant whose size is the same as that of a Javalong
, and byte order set toByteOrder.nativeOrder()
. The alignment of this layout (seeMemoryLayout.byteAlignment()
is platform-dependent, so that the following invariant holds:MemoryLayouts.JAVA_LONG.byteAlignment() == MemoryLayouts.ADDRESS.byteSize();
-
JAVA_FLOAT
A value layout constant whose size is the same as that of a Javafloat
, and byte order set toByteOrder.nativeOrder()
. -
JAVA_DOUBLE
A value layout constant whose size is the same as that of a Javadouble
, and byte order set toByteOrder.nativeOrder()
. The alignment of this layout (seeMemoryLayout.byteAlignment()
is platform-dependent, so that the following invariant holds:MemoryLayouts.JAVA_DOUBLE.byteAlignment() == MemoryLayouts.ADDRESS.byteSize();
-