Interface MappedSegment

All Superinterfaces:
AutoCloseable
All Known Implementing Classes:
JdkMappedSegment, PosixMappedSegment

public interface MappedSegment extends AutoCloseable
A closeable segment backed by a mapped file.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
     
    void
    madvise(long offset, long length, int advice)
    Advises the operating system about the expected access pattern for the specified memory region, allowing the kernel to optimize paging behavior.
    void
    prefetch(long offset, long length)
    Prefetches the given offset and length.
    Returns the underlying MemorySegment backing this mapped region.
    slice(long index, long length)
    Returns a slice of this segment.
  • Method Details

    • segment

      MemorySegment segment()
      Returns the underlying MemorySegment backing this mapped region.
    • slice

      MappedSegment slice(long index, long length)
      Returns a slice of this segment. Closing a slice does not close its parent.
    • prefetch

      void prefetch(long offset, long length)
      Prefetches the given offset and length.
    • madvise

      void madvise(long offset, long length, int advice)
      Advises the operating system about the expected access pattern for the specified memory region, allowing the kernel to optimize paging behavior.
      Parameters:
      offset - the starting offset within the buffer
      length - the length of the region in bytes
      advice - the access pattern advice; see MadviseAdvice constants
    • close

      void close()
      Specified by:
      close in interface AutoCloseable