# Uses of Interface
java.lang.foreign.ValueLayout.OfInt

Packages that use ValueLayout.OfInt
Package
Description
java.lang.foreign
Provides low-level access to memory and functions outside the Java runtime.

## Uses of ValueLayout.OfInt in java.lang.foreign

Fields in java.lang.foreign declared as ValueLayout.OfInt
Modifier and Type
Field
Description
`static final ValueLayout.OfInt`
ValueLayout.`JAVA_INT`
A value layout constant whose size is the same as that of a Java `int`, byte alignment set to 4, and byte order set to `ByteOrder.nativeOrder()`.
`static final ValueLayout.OfInt`
ValueLayout.`JAVA_INT_UNALIGNED`
An unaligned value layout constant whose size is the same as that of a Java `int` and byte order set to `ByteOrder.nativeOrder()`.
Methods in java.lang.foreign that return ValueLayout.OfInt
Modifier and Type
Method
Description
`ValueLayout.OfInt`
ValueLayout.OfInt.`withByteAlignment(long byteAlignment)`
Returns a memory layout with the same characteristics as this layout, but with the given alignment constraint (in bytes).
`ValueLayout.OfInt`
ValueLayout.OfInt.`withName(String name)`
Returns a memory layout with the same characteristics as this layout, but with the given name.
`ValueLayout.OfInt`
ValueLayout.OfInt.`withOrder(ByteOrder order)`
Returns a value layout with the same characteristics as this layout, but with the given byte order.
`ValueLayout.OfInt`
ValueLayout.OfInt.`withoutName()`
Returns a memory layout with the same characteristics as this layout, but with no name.
Methods in java.lang.foreign with parameters of type ValueLayout.OfInt
Modifier and Type
Method
Description
`default MemorySegment`
SegmentAllocator.`allocateFrom(ValueLayout.OfInt layout, int value)`
Returns a new memory segment initialized with the provided int value.
`default MemorySegment`
SegmentAllocator.`allocateFrom(ValueLayout.OfInt elementLayout, int... elements)`
Returns a new memory segment initialized with the elements in the provided int array.
`int`
MemorySegment.`get(ValueLayout.OfInt layout, long offset)`
Reads an int from this segment at the given offset, with the given layout.
`int`
MemorySegment.`getAtIndex(ValueLayout.OfInt layout, long index)`
Reads an int from this segment at the given index, scaled by the given layout size.
`void`
MemorySegment.`set(ValueLayout.OfInt layout, long offset, int value)`
Writes an int into this segment at the given offset, with the given layout.
`void`
MemorySegment.`setAtIndex(ValueLayout.OfInt layout, long index, int value)`
Writes an int into this segment at the given index, scaled by the given layout size.
`int[]`
MemorySegment.`toArray(ValueLayout.OfInt elementLayout)`
Copy the contents of this memory segment into a new int array.