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));
Implementation Specification
This class is immutable, thread-safe and value-based.
| Modifier and Type | Method and Description |
|---|---|
| public long | Returns: the element count of this sequence layoutReturns the element count of this sequence layout. |
| public MemoryLayout | Returns: the element layout of this sequence layoutReturns the element layout of this sequence layout. |
| public SequenceLayout | Returns: a sequence layout with the same size as this layout (but, possibly, with different element count), whose element layout is not a sequence layoutReturns a flattened sequence layout. |
| public SequenceLayout | Returns: a sequence layout where element layouts in the flattened projection of this sequence layout (seeflatten()) are re-arranged into one or more nested
sequence layoutsan array of element counts, of which at most one can be elementCounts)-1Rearranges the elements in this sequence layout into a multidimensional sequence layout. |
| public SequenceLayout | withByteAlignment(long byteAlignment)
Redeclares java. Returns a memory layout with the same characteristics as this layout, but with the given alignment constraint (in bytes). |
| public SequenceLayout | Returns: a sequence layout with the same characteristics of this layout, but with the given element countthe new element count elementCount)Returns a sequence layout with the same characteristics of this layout, but with the given element count. |
| public SequenceLayout | withName(String name)
Redeclares java. Returns a memory layout with the same characteristics as this layout, but with the given name. |
| public MemoryLayout | withoutName()
Redeclares java. Returns a memory layout with the same characteristics as this layout, but with no name. |
| elementCount | back to summary |
|---|---|
| public long elementCount() Returns the element count of this sequence layout.
| |
| elementLayout | back to summary |
|---|---|
| public MemoryLayout elementLayout() Returns the element layout of this sequence layout.
| |
| flatten | back to summary |
|---|---|
| public SequenceLayout flatten() Returns a flattened sequence layout. The element layout of the returned sequence layout is the first non-sequence layout found by inspecting (recursively, if needed) the element layout of this sequence layout: MemoryLayout flatElementLayout(SequenceLayout sequenceLayout) { return switch (sequenceLayout.elementLayout()) { case SequenceLayout nestedSequenceLayout -> flatElementLayout(nestedSequenceLayout); case MemoryLayout layout -> 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: var 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);
| |
| reshape | back to summary |
|---|---|
| public SequenceLayout reshape(long... elementCounts) Rearranges the elements in this sequence layout into a multidimensional sequence layout. The resulting layout is a sequence layout where element layouts in the flattened projection of this sequence layout are rearranged 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: var 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 counts is the special value var reshapeSeqImplicit1 = seq.reshape(-1, 6); var reshapeSeqImplicit2 = seq.reshape(2, -1);
| |
| withByteAlignment | back to summary |
|---|---|
| public SequenceLayout withByteAlignment(long byteAlignment) Redeclares java. Doc from java. Returns a memory layout with the same characteristics as this layout, but with the given alignment constraint (in bytes).
| |
| withElementCount | back to summary |
|---|---|
| public SequenceLayout withElementCount(long elementCount) Returns a sequence layout with the same characteristics of this layout, but with the given element count.
| |
| withName | back to summary |
|---|---|
| public SequenceLayout withName(String name) Redeclares java. Doc from java. Returns a memory layout with the same characteristics as this layout, but with the given name.
| |
| withoutName | back to summary |
|---|---|
| public MemoryLayout withoutName() Redeclares java. Doc from java. Returns a memory layout with the same characteristics as this layout, but with no name.
| |