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

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

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

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