Arena.allocate(long byteSize,
long byteAlignment)
Returns a native memory segment with the given size (in bytes) and alignment constraint (in bytes).
SegmentAllocator.allocate(long byteSize)
Returns a new memory segment with the given byteSize
.
SegmentAllocator.allocate(long byteSize,
long byteAlignment)
Returns a new memory segment with the given byteSize
and byteAlignment
.
Returns a new memory segment with the given layout.
Returns a new memory segment with the given elementLayout
and count
.
Returns a new memory segment initialized with the address of the provided value
as
specified by the provided layout
(i.e. byte ordering, alignment and size).
Returns a new memory segment initialized with the provided byte
value
as
specified by the provided layout
(i.e. byte ordering, alignment and size).
Returns a new memory segment with a
byteSize() of
E*layout.byteSize()
initialized with the provided
E
byte
elements
as
specified by the provided
layout
(i.e. byte ordering, alignment and size).
Returns a new memory segment initialized with the provided char
value
as
specified by the provided layout
(i.e. byte ordering, alignment and size).
Returns a new memory segment with a
byteSize() of
E*layout.byteSize()
initialized with the provided
E
char
elements
as
specified by the provided
layout
(i.e. byte ordering, alignment and size).
Returns a new memory segment initialized with the provided double
value
as
specified by the provided layout
(i.e. byte ordering, alignment and size).
Returns a new memory segment with a
byteSize() of
E*layout.byteSize()
initialized with the provided
E
double
elements
as
specified by the provided
layout
(i.e. byte ordering, alignment and size).
Returns a new memory segment initialized with the provided float
value
as
specified by the provided layout
(i.e. byte ordering, alignment and size).
Returns a new memory segment with a
byteSize() of
E*layout.byteSize()
initialized with the provided
E
float
elements
as
specified by the provided
layout
(i.e. byte ordering, alignment and size).
Returns a new memory segment initialized with the provided int
value
as
specified by the provided layout
(i.e. byte ordering, alignment and size).
Returns a new memory segment with a
byteSize() of
E*layout.byteSize()
initialized with the provided
E
int
elements
as
specified by the provided
layout
(i.e. byte ordering, alignment and size).
Returns a new memory segment initialized with the provided long
value
as
specified by the provided layout
(i.e. byte ordering, alignment and size).
Returns a new memory segment with a
byteSize() of
E*layout.byteSize()
initialized with the provided
E
long
elements
as
specified by the provided
layout
(i.e. byte ordering, alignment and size).
Returns a new memory segment initialized with the provided short
value
as
specified by the provided layout
(i.e. byte ordering, alignment and size).
Returns a new memory segment with a
byteSize() of
E*layout.byteSize()
initialized with the provided
E
short
elements
as
specified by the provided
layout
(i.e. byte ordering, alignment and size).
Converts a Java string into a null-terminated C string using the
UTF-8 charset,
storing the result into a memory segment.
Converts a Java string into a null-terminated C string using the provided charset,
and storing the result into a memory segment.
Returns a read-only view of this segment.
Returns a slice of this memory segment, at the given offset.
MemorySegment.asSlice(long offset,
long newSize)
Returns a slice of this memory segment, at the given offset.
MemorySegment.asSlice(long offset,
long newSize,
long byteAlignment)
Returns a slice of this memory segment, at the given offset, with the provided alignment constraint.
Returns a slice of this memory segment with the given layout, at the given offset.
Performs a bulk copy from given source segment to this segment.
MemorySegment.fill(byte value)
Fills the contents of this memory segment with the given value.
Reads an address from this segment at the given offset, with the given layout.
Reads an address from this segment at the given at the given index, scaled by the given layout size.
Creates a zero-length native segment from the given
address value.
MemorySegment.ofArray(byte[] byteArray)
Creates a heap segment backed by the on-heap region of memory that holds the given byte array.
MemorySegment.ofArray(char[] charArray)
Creates a heap segment backed by the on-heap region of memory that holds the given char array.
MemorySegment.ofArray(double[] doubleArray)
Creates a heap segment backed by the on-heap region of memory that holds the given double array.
MemorySegment.ofArray(float[] floatArray)
Creates a heap segment backed by the on-heap region of memory that holds the given float array.
MemorySegment.ofArray(int[] intArray)
Creates a heap segment backed by the on-heap region of memory that holds the given int array.
MemorySegment.ofArray(long[] longArray)
Creates a heap segment backed by the on-heap region of memory that holds the given long array.
MemorySegment.ofArray(short[] shortArray)
Creates a heap segment backed by the on-heap region of memory that holds the given short array.
Creates a memory segment that is backed by the same region of memory that backs the given
Buffer
instance.
Returns a new memory segment that has the same address and scope as this segment, but with the provided size.
Returns a new segment with the same address as this segment, but with the provided size and scope.
Returns a new memory segment with the same address and size as this segment, but with the provided scope.
Creates an upcall stub which can be passed to other foreign functions as a function pointer, associated with the given
arena.
Returns a new memory segment initialized with the address of the provided value
as
specified by the provided layout
(i.e. byte ordering, alignment and size).
Returns a slice of this segment that is the overlap between this and
the provided segment.
static void
Performs a bulk copy from source segment to destination segment.
static void
Performs a bulk copy from source segment to destination segment.
static void
Copies a number of elements from a source memory segment to a destination array.
static void
Copies a number of elements from a source array to a destination memory segment.
Performs a bulk copy from given source segment to this segment.
Creates a method handle which is used to call a foreign function with the given signature and address.
default long
Finds and returns the offset, in bytes, of the first mismatch between
this segment and the given other segment.
static long
Finds and returns the relative offset, in bytes, of the first mismatch between the source and the destination
segments.
Returns a segment allocator which responds to allocation requests by recycling a single segment.
default void
Writes an address into this segment at the given offset, with the given layout.
default void
Writes an address into this segment at the given index, scaled by the given layout size.
Returns a segment allocator which responds to allocation requests by returning consecutive slices
obtained from the provided segment.