- All Implemented Interfaces:
- Constable,- MemoryLayout
MemoryLayout.sequenceLayout(3, ValueLayout.JAVA_INT.withOrder(ByteOrder.BIG_ENDIAN));
MemoryLayout.structLayout(
    ValueLayout.JAVA_INT.withOrder(ByteOrder.BIG_ENDIAN),
    ValueLayout.JAVA_INT.withOrder(ByteOrder.BIG_ENDIAN),
    ValueLayout.JAVA_INT.withOrder(ByteOrder.BIG_ENDIAN));
 This is a value-based
 class; programmers should treat instances that are
 equal as interchangeable and should not
 use instances for synchronization, or unpredictable behavior may
 occur. For example, in a future release, synchronization may fail.
 The equals method should be used for comparisons.
 
 Unless otherwise specified, passing a null argument, or an array argument containing one or more null
 elements to a method in this class causes a NullPointerException to be thrown. 
- Implementation Requirements:
- This class is immutable and thread-safe.
- 
Nested Class SummaryNested classes/interfaces declared in interface jdk.incubator.foreign.MemoryLayoutMemoryLayout.PathElement
- 
Method SummaryModifier and TypeMethodDescriptionfinal longReturns the alignment constraint associated with this layout, expressed in bits.longbitSize()Returns the layout size, in bits.longbyteSize()Returns the layout size, in bytes.Returns the element count of this sequence layout (if any).Returns the element layout associated with this sequence layout.booleanIndicates whether some other object is "equal to" this one.flatten()Returns a new, flattened sequence layout whose element layout is the first non-sequence element layout found by recursively traversing the element layouts of this sequence layout.inthashCode()Returns a hash code value for the object.booleanhasSize()Returnstrueif this layout has a specified size.booleanReturns true, if this layout is a padding layout.name()Returns the name (if any) associated with this layout.reshape(long... elementCounts) Returns a new sequence layout where element layouts in the flattened projection of this sequence layout (seeflatten()) are re-arranged into one or more nested sequence layouts according to the provided element counts.toString()Returns a string representation of the object.withBitAlignment(long alignmentBits) Creates a new layout which features the desired alignment constraint.withElementCount(long elementCount) Obtains a new sequence layout with same element layout, alignment constraints and name as this sequence layout but with the new specified element count.Creates a new layout which features the desired layout name.Methods declared in class java.lang.Objectclone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods declared in interface jdk.incubator.foreign.MemoryLayoutbitAlignment, bitOffset, bitOffsetHandle, bitSize, byteAlignment, byteOffset, byteOffsetHandle, byteSize, hasSize, isPadding, map, name, select, sliceHandle, varHandle
- 
Method Details- 
elementLayoutReturns the element layout associated with this sequence layout.- Returns:
- the element layout associated with this sequence layout
 
- 
elementCountReturns the element count of this sequence layout (if any).- Returns:
- the element count of this sequence layout (if any)
 
- 
withElementCountObtains a new sequence layout with same element layout, alignment constraints and name as this sequence layout but with the new specified element count.- Parameters:
- elementCount- the new element count.
- Returns:
- a new sequence with given element count.
- Throws:
- IllegalArgumentException- if- elementCount < 0.
 
- 
reshapeReturns a new sequence layout where element layouts in the flattened projection of this sequence layout (seeflatten()) are re-arranged into one or more nested sequence layouts according to the provided element counts. This transformation preserves the layout size; that is, multiplying the provided element counts must yield the same element count as the flattened projection of this sequence layout.For instance, given a sequence layout of the kind: callingvar seq = MemoryLayout.sequenceLayout(4, MemoryLayout.sequenceLayout(3, ValueLayout.JAVA_INT));seq.reshape(2, 6)will yield the following sequence layout:var reshapeSeq = MemoryLayout.sequenceLayout(2, MemoryLayout.sequenceLayout(6, ValueLayout.JAVA_INT));If one of the provided element count is the special value -1, then the element count in that position will be inferred from the remaining element counts and the element count of the flattened projection of this layout. For instance, a layout equivalent to the abovereshapeSeqcan also be computed in the following ways:var reshapeSeqImplicit1 = seq.reshape(-1, 6); var reshapeSeqImplicit2 = seq.reshape(2, -1);- Parameters:
- elementCounts- an array of element counts, of which at most one can be- -1.
- Returns:
- a new sequence layout where element layouts in the flattened projection of this
 sequence layout (see flatten()) are re-arranged into one or more nested sequence layouts.
- Throws:
- UnsupportedOperationException- if this sequence layout does not have an element count.
- IllegalArgumentException- if two or more element counts are set to- -1, or if one or more element count is- <= 0(but other than- -1) or, if, after any required inference, multiplying the element counts does not yield the same element count as the flattened projection of this sequence layout.
 
- 
flattenReturns a new, flattened sequence layout whose element layout is the first non-sequence element layout found by recursively traversing the element layouts of this sequence layout. This transformation preserves the layout size; nested sequence layout in this sequence layout will be dropped and their element counts will be incorporated into that of the returned sequence layout. For instance, given a sequence layout of the kind:callingvar seq = MemoryLayout.sequenceLayout(4, MemoryLayout.sequenceLayout(3, ValueLayout.JAVA_INT));seq.flatten()will yield the following sequence layout:var flattenedSeq = MemoryLayout.sequenceLayout(12, ValueLayout.JAVA_INT);- Returns:
- a new sequence layout with the same size as this layout (but, possibly, with different element count), whose element layout is not a sequence layout.
- Throws:
- UnsupportedOperationException- if this sequence layout, or one of the nested sequence layouts being flattened, does not have an element count.
 
- 
toStringDescription copied from class:ObjectReturns a string representation of the object.- Specified by:
- toStringin interface- MemoryLayout
- Overrides:
- toStringin class- Object
- Returns:
- a string representation of the object.
 
- 
equalsDescription copied from class:ObjectIndicates whether some other object is "equal to" this one.The equalsmethod implements an equivalence relation on non-null object references:- It is reflexive: for any non-null reference value
     x,x.equals(x)should returntrue.
- It is symmetric: for any non-null reference values
     xandy,x.equals(y)should returntrueif and only ify.equals(x)returnstrue.
- It is transitive: for any non-null reference values
     x,y, andz, ifx.equals(y)returnstrueandy.equals(z)returnstrue, thenx.equals(z)should returntrue.
- It is consistent: for any non-null reference values
     xandy, multiple invocations ofx.equals(y)consistently returntrueor consistently returnfalse, provided no information used inequalscomparisons on the objects is modified.
- For any non-null reference value x,x.equals(null)should returnfalse.
 An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes. - Specified by:
- equalsin interface- MemoryLayout
- Parameters:
- other- the reference object with which to compare.
- Returns:
- trueif this object is the same as the obj argument;- falseotherwise.
- See Also:
 
- It is reflexive: for any non-null reference value
     
- 
hashCodepublic int hashCode()Description copied from class:ObjectReturns a hash code value for the object. This method is supported for the benefit of hash tables such as those provided byHashMap.The general contract of hashCodeis:- Whenever it is invoked on the same object more than once during
     an execution of a Java application, the hashCodemethod must consistently return the same integer, provided no information used inequalscomparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
- If two objects are equal according to the equalsmethod, then calling thehashCodemethod on each of the two objects must produce the same integer result.
- It is not required that if two objects are unequal
     according to the equalsmethod, then calling thehashCodemethod on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
 - Specified by:
- hashCodein interface- MemoryLayout
- Returns:
- a hash code value for this object.
- See Also:
 
- Whenever it is invoked on the same object more than once during
     an execution of a Java application, the 
- 
describeConstableDescription copied from interface:MemoryLayoutReturns anOptionalcontaining the nominal descriptor for this layout, if one can be constructed, or an emptyOptionalif one cannot be constructed.- Specified by:
- describeConstablein interface- Constable
- Specified by:
- describeConstablein interface- MemoryLayout
- Returns:
- an Optionalcontaining the nominal descriptor for this layout, if one can be constructed, or an emptyOptionalif one cannot be constructed
 
- 
withNameCreates a new layout which features the desired layout name.- Specified by:
- withNamein interface- MemoryLayout
- Parameters:
- name- the layout name.
- Returns:
- a new layout which is the same as this layout, except for the name associated with it.
- See Also:
 
- 
withBitAlignmentCreates a new layout which features the desired alignment constraint.- Specified by:
- withBitAlignmentin interface- MemoryLayout
- Parameters:
- alignmentBits- the layout alignment constraint, expressed in bits.
- Returns:
- a new layout which is the same as this layout, except for the alignment constraint associated with it.
 
- 
nameDescription copied from interface:MemoryLayoutReturns the name (if any) associated with this layout.- Specified by:
- namein interface- MemoryLayout
- Returns:
- the name (if any) associated with this layout
- See Also:
 
- 
bitAlignmentpublic final long bitAlignment()Description copied from interface:MemoryLayoutReturns the alignment constraint associated with this layout, expressed in bits. Layout alignment defines a power of twoAwhich is the bit-wise alignment of the layout. IfA <= 8thenA/8is the number of bytes that must be aligned for any pointer that correctly points to this layout. Thus:- A=8means unaligned (in the usual sense), which is common in packets.
- A=64means word aligned (on LP64),- A=32int aligned,- A=16short aligned, etc.
- A=512is the most strict alignment required by the x86/SV ABI (for AVX-512 data).
 MemoryLayout.withBitAlignment(long)), then this method returns the natural alignment constraint (in bits) associated with this layout.- Specified by:
- bitAlignmentin interface- MemoryLayout
- Returns:
- the layout alignment constraint, in bits.
 
- 
byteSizepublic long byteSize()Description copied from interface:MemoryLayoutReturns the layout size, in bytes.- Specified by:
- byteSizein interface- MemoryLayout
- Returns:
- the layout size, in bytes
 
- 
hasSizepublic boolean hasSize()Description copied from interface:MemoryLayoutReturnstrueif this layout has a specified size. A layout does not have a specified size if it is (or contains) a sequence layout whose size is unspecified (seeelementCount()). Value layouts (seeValueLayout) and padding layouts (seeMemoryLayout.paddingLayout(long)) always have a specified size, therefore this method always returnstruein these cases.- Specified by:
- hasSizein interface- MemoryLayout
- Returns:
- true, if this layout has a specified size.
 
- 
bitSizepublic long bitSize()Description copied from interface:MemoryLayoutReturns the layout size, in bits.- Specified by:
- bitSizein interface- MemoryLayout
- Returns:
- the layout size, in bits
 
- 
isPaddingpublic boolean isPadding()Description copied from interface:MemoryLayoutReturns true, if this layout is a padding layout.- Specified by:
- isPaddingin interface- MemoryLayout
- Returns:
- true, if this layout is a padding layout
 
 
-