• Nested Class Summary

    Nested Classes

    static interface 

    A scope models the lifetime of all the memory segments associated with it.

  • Field Summary

    Fields

    A zero-length native segment modelling the NULL address.

  • Method Summary

    long

    address()

    Returns the address of this memory segment.

    Returns a slice of this segment that is the overlap between this and the provided segment.

    Returns a read-only view of this segment.

    asSlice(long offset)

    Returns a slice of this memory segment, at the given offset.

    asSlice(long offset, long newSize)

    Returns a slice of this memory segment, at the given offset.

    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.

    long

    byteSize()

    Returns the size (in bytes) of this memory 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 the given source segment to this segment.

    Returns a sequential Stream over disjoint slices (whose size matches that of the specified layout) in this segment.

    boolean

    Compares the specified object with this memory segment for equality.

    fill(byte value)

    Fills the contents of this memory segment with the given value.

    void

    force()

    Forces any changes made to the contents of this mapped segment to be written to the storage device described by the mapped segment's file descriptor.

    Reads an address from this segment at the given offset, with the given layout.

    boolean

    Reads a boolean from this segment at the given offset, with the given layout.

    byte

    Reads a byte from this segment at the given offset, with the given layout.

    char

    Reads a char from this segment at the given offset, with the given layout.

    double

    Reads a double from this segment at the given offset, with the given layout.

    float

    Reads a float from this segment at the given offset, with the given layout.

    int

    Reads an int from this segment at the given offset, with the given layout.

    long

    Reads a long from this segment at the given offset, with the given layout.

    short

    Reads a short 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.

    boolean

    Reads a boolean from this segment at the given index, scaled by the given layout size.

    byte

    Reads a byte from this segment at the given index, scaled by the given layout size.

    char

    Reads a char from this segment at the given index, scaled by the given layout size.

    double

    Reads a double from this segment at the given index, scaled by the given layout size.

    float

    Reads a float from this segment at the given index, scaled by the given layout size.

    int

    Reads an int from this segment at the given index, scaled by the given layout size.

    long

    Reads a long from this segment at the given index, scaled by the given layout size.

    short

    Reads a short from this segment at the given index, scaled by the given layout size.

    getString(long offset)

    Reads a null-terminated string from this segment at the given offset, using the UTF-8 charset.

    getString(long offset, Charset charset)

    Reads a null-terminated string from this segment at the given offset, using the provided charset.

    int

    hashCode()

    Returns the hash code value for this memory segment.

    heapBase()

    Returns the Java object stored in the on-heap region of memory backing this memory segment, if any.

    boolean

    Returns true if this segment can be accessed from the provided thread.

    boolean

    isLoaded()

    Determines whether all the contents of this mapped segment are resident in physical memory.

    boolean

    isMapped()

    Returns true if this segment is a mapped segment.

    boolean

    isNative()

    Returns true if this segment is a native segment.

    boolean

    Returns true, if this segment is read-only.

    void

    load()

    Loads the contents of this mapped segment into physical memory.

    long

    Finds and returns the offset, in bytes, of the first mismatch between this segment and the given other segment.

    static long

    mismatch(MemorySegment srcSegment, long srcFromOffset, long srcToOffset, MemorySegment dstSegment, long dstFromOffset, long dstToOffset)

    Finds and returns the relative offset, in bytes, of the first mismatch between the source and the destination segments.

    ofAddress(long address)

    Creates a zero-length native segment from the given address value.

    ofArray(byte[] byteArray)

    Creates a heap segment backed by the on-heap region of memory that holds the given byte array.

    ofArray(char[] charArray)

    Creates a heap segment backed by the on-heap region of memory that holds the given char array.

    ofArray(double[] doubleArray)

    Creates a heap segment backed by the on-heap region of memory that holds the given double array.

    ofArray(float[] floatArray)

    Creates a heap segment backed by the on-heap region of memory that holds the given float array.

    ofArray(int[] intArray)

    Creates a heap segment backed by the on-heap region of memory that holds the given int array.

    ofArray(long[] longArray)

    Creates a heap segment backed by the on-heap region of memory that holds the given long array.

    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.

    reinterpret(long newSize)

    Restricted.

    Returns a new memory segment that has the same address and scope as this segment, but with the provided size.

    Restricted.

    Returns a new segment with the same address as this segment, but with the provided size and scope.

    Restricted.

    Returns a new memory segment with the same address and size as this segment, but with the provided scope.

    scope()

    Returns the scope associated with this memory segment.

    void

    Writes an address into this segment at the given offset, with the given layout.

    void

    Writes a boolean into this segment at the given offset, with the given layout.

    void

    Writes a byte into this segment at the given offset, with the given layout.

    void

    Writes a char into this segment at the given offset, with the given layout.

    void

    Writes a double into this segment at the given offset, with the given layout.

    void

    Writes a float into this segment at the given offset, with the given layout.

    void

    Writes an int into this segment at the given offset, with the given layout.

    void

    Writes a long into this segment at the given offset, with the given layout.

    void

    Writes a short into this segment at the given offset, with the given layout.

    void

    Writes an address into this segment at the given index, scaled by the given layout size.

    void

    Writes a boolean into this segment at the given index, scaled by the given layout size.

    void

    Writes a byte into this segment at the given index, scaled by the given layout size.

    void

    Writes a char into this segment at the given index, scaled by the given layout size.

    void

    Writes a double into this segment at the given index, scaled by the given layout size.

    void

    Writes a float into this segment at the given index, scaled by the given layout size.

    void

    Writes an int into this segment at the given index, scaled by the given layout size.

    void

    Writes a long into this segment at the given index, scaled by the given layout size.

    void

    Writes a short into this segment at the given index, scaled by the given layout size.

    void

    Writes the given string into this segment at the given offset, converting it to a null-terminated byte sequence using the UTF-8 charset.

    void

    Writes the given string into this segment at the given offset, converting it to a null-terminated byte sequence using the provided charset.

    Returns a spliterator for this memory segment.

    byte[]

    Copy the contents of this memory segment into a new byte array.

    char[]

    Copy the contents of this memory segment into a new char array.

    double[]

    Copy the contents of this memory segment into a new double array.

    float[]

    Copy the contents of this memory segment into a new float array.

    int[]

    Copy the contents of this memory segment into a new int array.

    long[]

    Copy the contents of this memory segment into a new long array.

    short[]

    Copy the contents of this memory segment into a new short array.

    void

    unload()

    Unloads the contents of this mapped segment from physical memory.

  • Field Details

    • NULL

  • Method Details

    • address

    • heapBase

    • spliterator

    • elements

    • scope

    • isAccessibleBy

    • byteSize

    • asSlice

    • asSlice

    • asSlice

    • asSlice

    • reinterpret

    • reinterpret

    • reinterpret

    • isReadOnly

    • asReadOnly

    • isNative

    • isMapped

    • asOverlappingSlice

    • fill

    • copyFrom

    • mismatch

    • isLoaded

    • load

    • unload

    • force

    • asByteBuffer

    • toArray

    • toArray

    • toArray

    • toArray

    • toArray

    • toArray

    • toArray

    • getString

    • getString

    • setString

    • setString

    • ofBuffer

    • ofArray

    • ofArray

    • ofArray

    • ofArray

    • ofArray

    • ofArray

    • ofArray

    • ofAddress

    • copy

    • copy

    • get

    • set

    • get

    • set

    • get

    • set

    • get

    • set

    • get

    • set

    • get

    • set

    • get

    • set

    • get

    • set

    • get

    • set

    • getAtIndex

    • getAtIndex

    • getAtIndex

    • setAtIndex

    • getAtIndex

    • setAtIndex

    • setAtIndex

    • setAtIndex

    • getAtIndex

    • setAtIndex

    • getAtIndex

    • setAtIndex

    • getAtIndex

    • setAtIndex

    • getAtIndex

    • setAtIndex

    • getAtIndex

    • setAtIndex

    • equals

    • hashCode

    • copy

    • copy

    • mismatch