public abstract class

MappedByteBuffer

extends ByteBuffer
java.lang.Object
   ↳ java.nio.Buffer
     ↳ java.nio.ByteBuffer
       ↳ java.nio.MappedByteBuffer

Class Overview

MappedByteBuffer is a special kind of direct byte buffer which maps a region of file to memory.

MappedByteBuffer can be created by calling FileChannel.map. Once created, the mapping between the byte buffer and the file region remains valid until the byte buffer is garbage collected.

All or part of a MappedByteBuffer's content may change or become inaccessible at any time, since the mapped file region can be modified by another thread or process at any time. If this happens, the behavior of the MappedByteBuffer is undefined.

Summary

Public Methods
final MappedByteBuffer force()
Writes all changes of the buffer to the mapped file.
final boolean isLoaded()
Returns true if there is a high probability that every page of this buffer is currently loaded in RAM, meaning that accesses will not cause a page fault.
final MappedByteBuffer load()
Attempts to load every page of this buffer into RAM.
[Expand]
Inherited Methods
From class java.nio.ByteBuffer
From class java.nio.Buffer
From class java.lang.Object
From interface java.lang.Comparable

Public Methods

public final MappedByteBuffer force ()

Since: API Level 1

Writes all changes of the buffer to the mapped file. If the mapped file is stored on a local device, it is guaranteed that the changes are written to the file. No such guarantee is given if the file is located on a remote device.

Returns
  • this buffer.

public final boolean isLoaded ()

Since: API Level 1

Returns true if there is a high probability that every page of this buffer is currently loaded in RAM, meaning that accesses will not cause a page fault. It is impossible to give a strong guarantee since this is only a snapshot of a dynamic situation.

public final MappedByteBuffer load ()

Since: API Level 1

Attempts to load every page of this buffer into RAM. See isLoaded().

Returns
  • this buffer.