Module java.base

Interface ValueLayout.OfAddress

All Superinterfaces:
MemoryLayoutPREVIEW, ValueLayoutPREVIEW
Enclosing interface:
ValueLayoutPREVIEW

public static sealed interface ValueLayout.OfAddress extends ValueLayoutPREVIEW
OfAddress is a preview API of the Java platform.
Programs can only use OfAddress when preview features are enabled.
Preview features may be removed in a future release, or upgraded to permanent features of the Java platform.
A value layout whose carrier is MemorySegment.class.
Since:
19
See Also:
  • Method Details

    • withName

      Returns a memory layout of the same type with the same size and alignment constraint as this layout, but with the specified name.
      Specified by:
      withName in interface MemoryLayoutPREVIEW
      Specified by:
      withName in interface ValueLayoutPREVIEW
      Parameters:
      name - the layout name.
      Returns:
      a memory layout with the given name.
      See Also:
    • withBitAlignment

      ValueLayout.OfAddressPREVIEW withBitAlignment(long bitAlignment)
      Returns a memory layout of the same type with the same size and name as this layout, but with the specified alignment constraint (in bits).
      Specified by:
      withBitAlignment in interface MemoryLayoutPREVIEW
      Specified by:
      withBitAlignment in interface ValueLayoutPREVIEW
      Parameters:
      bitAlignment - the layout alignment constraint, expressed in bits.
      Returns:
      a memory layout with the given alignment constraint.
    • withOrder

      Returns a value layout with the same carrier, alignment constraint and name as this value layout, but with the specified byte order.
      Specified by:
      withOrder in interface ValueLayoutPREVIEW
      Parameters:
      order - the desired byte order.
      Returns:
      a value layout with the given byte order.
    • asUnbounded

      Returns an unbounded address layout with the same carrier, alignment constraint, name and order as this address layout, but with the specified pointee layout. An unbounded address layout allow raw addresses to be accessed as memory segmentsPREVIEW whose size is set to Long.MAX_VALUE. As such, these segments can be used in subsequent access operations.

      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.

      Returns:
      an unbounded address layout with same characteristics as this layout.
      Throws:
      IllegalCallerException - If the caller is in a module that does not have native access enabled.
      See Also:
    • isUnbounded

      boolean isUnbounded()
      Returns true, if this address layout is an unbounded address layout..
      Returns:
      true, if this address layout is an unbounded address layout