Module jdk.incubator.foreign
Package jdk.incubator.foreign

# Class ValueLayout.OfChar

java.lang.Object
jdk.incubator.foreign.ValueLayout
jdk.incubator.foreign.ValueLayout.OfChar

All Implemented Interfaces:
  `Constable`, `MemoryLayout`

Enclosing class:
  `ValueLayout`

public static final class ValueLayout.OfChar extends ValueLayout
A value layout whose carrier is `char.class`.

## Nested Class Summary

## Nested classes/interfaces declared in class jdk.incubator.foreign.ValueLayout

`ValueLayout.OfAddress, ValueLayout.OfBoolean, ValueLayout.OfByte, ValueLayout.OfChar, ValueLayout.OfDouble, ValueLayout.OfFloat, ValueLayout.OfInt, ValueLayout.OfLong, ValueLayout.OfShort`

## Nested classes/interfaces declared in interface jdk.incubator.foreign.MemoryLayout

`MemoryLayout.PathElement`

## Field Summary

### Fields declared in class jdk.incubator.foreign.ValueLayout

`ADDRESS, JAVA_BOOLEAN, JAVA_BYTE, JAVA_CHAR, JAVA_DOUBLE, JAVA_FLOAT, JAVA_INT, JAVA_LONG, JAVA_SHORT`

## Method Summary

Modifier and Type
Method
Description
`final long`
`bitAlignment()`
Returns the alignment constraint associated with this layout, expressed in bits.
`long`
`bitSize()`
Returns the layout size, in bits.
`long`
`byteSize()`
Returns the layout size, in bytes.
`boolean`
`hasSize()`
Returns `true` if this layout has a specified size.
`boolean`
`isPadding()`
Returns true, if this layout is a padding layout.
`final Optional<String>`
`name()`
Returns the name (if any) associated with this layout.
`ValueLayout.OfChar`
`withBitAlignment(long alignmentBits)`
Creates a new layout which features the desired alignment constraint.
`ValueLayout.OfChar`
`withName(String name)`
Creates a new layout which features the desired layout name.
`ValueLayout.OfChar`
`withOrder(ByteOrder order)`
Returns a new value layout with given byte order.

### Methods declared in class jdk.incubator.foreign.ValueLayout

`carrier, describeConstable, equals, hashCode, order, toString`

### Methods declared in class java.lang.Object

`clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

### Methods declared in interface jdk.incubator.foreign.MemoryLayout

`bitAlignment, bitOffset, bitOffsetHandle, bitSize, byteAlignment, byteOffset, byteOffsetHandle, byteSize, hasSize, isPadding, map, name, select, sliceHandle, varHandle`

## Method Details

### withName

public ValueLayout.OfChar withName(String name)
Description copied from interface: `MemoryLayout`
Creates a new layout which features the desired layout name.

Specified by:
  `withName` in 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:
  - `MemoryLayout.name()`

### withBitAlignment

public ValueLayout.OfChar withBitAlignment(long alignmentBits)
Description copied from interface: `MemoryLayout`
Creates a new layout which features the desired alignment constraint.

Specified by:
  `withBitAlignment` in 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.

### withOrder

public ValueLayout.OfChar withOrder(ByteOrder order)
Description copied from class: `ValueLayout`
Returns a new value layout with given byte order.

Overrides:
  `withOrder` in class `ValueLayout`
Parameters:
  `order` - the desired byte order.
Returns:
  a new value layout with given byte order.

### name

public final Optional<String> name()
Description copied from interface: `MemoryLayout`
Returns the name (if any) associated with this layout.

Specified by:
  `name` in interface `MemoryLayout`
Returns:
  the name (if any) associated with this layout
See Also:
  - `MemoryLayout.withName(String)`

### bitAlignment

public final long bitAlignment()
Description copied from interface: `MemoryLayout`
Returns the alignment constraint associated with this layout, expressed in bits. Layout alignment defines a power of two `A` which is the bit-wise alignment of the layout. If `A <= 8` then `A/8` is the number of bytes that must be aligned for any pointer that correctly points to this layout. Thus:

- `A=8` means unaligned (in the usual sense), which is common in packets.
- `A=64` means word aligned (on LP64), `A=32` int aligned, `A=16` short aligned, etc.
- `A=512` is the most strict alignment required by the x86/SV ABI (for AVX-512 data).

If no explicit alignment constraint was set on this layout (see `MemoryLayout.withBitAlignment(long)`), then this method returns the natural alignment constraint (in bits) associated with this layout.

Specified by:
  `bitAlignment` in interface `MemoryLayout`
Returns:
  the layout alignment constraint, in bits.

### byteSize

public long byteSize()
Description copied from interface: `MemoryLayout`
Returns the layout size, in bytes.

Specified by:
  `byteSize` in interface `MemoryLayout`
Returns:
  the layout size, in bytes

### hasSize

public boolean hasSize()
Description copied from interface: `MemoryLayout`
Returns `true` if 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 (see `SequenceLayout.elementCount()`). Value layouts (see `ValueLayout`) and padding layouts (see `MemoryLayout.paddingLayout(long)`) always have a specified size, therefore this method always returns `true` in these cases.

Specified by:
  `hasSize` in interface `MemoryLayout`
Returns:
  `true`, if this layout has a specified size.

### bitSize

public long bitSize()
Description copied from interface: `MemoryLayout`
Returns the layout size, in bits.

Specified by:
  `bitSize` in interface `MemoryLayout`
Returns:
  the layout size, in bits

### isPadding

public boolean isPadding()
Description copied from interface: `MemoryLayout`
Returns true, if this layout is a padding layout.

Specified by:
  `isPadding` in interface `MemoryLayout`
Returns:
  true, if this layout is a padding layout