MemoryLayoutPREVIEW
, ValueLayoutPREVIEW
AddressLayout
is a preview API of the Java platform.
A value layout used to model the address of some region of memory. The carrier associated with an address layout is
MemorySegment.class
. The size and alignment of an address layout are platform-dependent (e.g. on a 64-bit platform, the size and alignment of an address layout are set to 8 bytes).
An address layout may optionally feature a target layout. An address layout with target layout T
can be used to model the address of a region of memory whose layout is T
. For instance, an address layout with target layout ValueLayout.JAVA_INT
PREVIEW can be used to model the address of a region of memory that is 4 bytes long. Specifying a target layout can be useful in the following situations:
MemorySegment.getAtIndex(AddressLayout, long)
PREVIEW;Linker.downcallHandle(FunctionDescriptor, Option...)
PREVIEW;Linker.upcallStub(MethodHandle, FunctionDescriptor, Arena, Option...)
PREVIEW.ADDRESS, ADDRESS_UNALIGNED, JAVA_BOOLEAN, JAVA_BYTE, JAVA_CHAR, JAVA_CHAR_UNALIGNED, JAVA_DOUBLE, JAVA_DOUBLE_UNALIGNED, JAVA_FLOAT, JAVA_FLOAT_UNALIGNED, JAVA_INT, JAVA_INT_UNALIGNED, JAVA_LONG, JAVA_LONG_UNALIGNED, JAVA_SHORT, JAVA_SHORT_UNALIGNED
Returns the target layout associated with this address layout (if any).
Returns a memory layout with the same characteristics as this layout, but with the given alignment constraint (in bytes).
Returns a memory layout with the same characteristics as this layout, but with the given name.
Returns a value layout with the same characteristics as this layout, but with the given byte order.
Returns a memory layout with the same characteristics as this layout, but with no name.
Returns an address layout with the same carrier, alignment constraint, name and order as this address layout, but with no target layout.
Returns an address layout with the same carrier, alignment constraint, name and order as this address layout, but associated with the specified target layout.
Methods declared in interface java.lang.foreign.MemoryLayoutPREVIEWbyteAlignment, byteOffset, byteOffsetHandle, byteSize, equals, hashCode, name, select, sliceHandle, toString, varHandle
Returns a memory layout with the same characteristics as this layout, but with the given name.
withName
in interface MemoryLayoutPREVIEW
withName
in interface ValueLayoutPREVIEW
name
- the layout name.
Returns a memory layout with the same characteristics as this layout, but with no name.
withoutName
in interface MemoryLayoutPREVIEW
withoutName
in interface ValueLayoutPREVIEW
Returns a memory layout with the same characteristics as this layout, but with the given alignment constraint (in bytes).
withByteAlignment
in interface MemoryLayoutPREVIEW
withByteAlignment
in interface ValueLayoutPREVIEW
byteAlignment
- the layout alignment constraint, expressed in bytes.
Returns a value layout with the same characteristics as this layout, but with the given byte order.
withOrder
in interface ValueLayoutPREVIEW
order
- the desired byte order.
Returns an address layout with the same carrier, alignment constraint, name and order as this address layout, but associated with the specified target layout. The returned address layout allows raw addresses to be accessed as
memory segmentsPREVIEWwhose size is set to the size of the specified layout. Moreover, if the accessed raw address is not compatible with the alignment constraint in the provided layout,
IllegalArgumentExceptionwill be thrown.
AddressLayout addressLayout = ...
AddressLayout unboundedLayout = addressLayout.withTargetLayout(
MemoryLayout.sequenceLayout(ValueLayout.JAVA_BYTE));
This method is restricted. Restricted methods are unsafe, and, if used incorrectly, their use might crash the JVM or, worse, silently result in memory corruption. Thus, clients should refrain from depending on restricted methods, and use safe and supported functionalities, where possible.
layout
- the target layout.
IllegalCallerException
- If the caller is in a module that does not have native access enabled.
Returns an address layout with the same carrier, alignment constraint, name and order as this address layout, but with no target layout.
Returns the target layout associated with this address layout (if any)..
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4