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()
Indicates whether this buffer's content is loaded.
final MappedByteBuffer load()
Loads this buffer's content into memory but it is not guaranteed to succeed.
[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 ()

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 ()

Indicates whether this buffer's content is loaded. If the result is true there is a high probability that the whole buffer memory is currently loaded in RAM. If it is false it is unsure if it is loaded or not.

Returns
  • true if this buffer's content is loaded, false otherwise.

public final MappedByteBuffer load ()

Loads this buffer's content into memory but it is not guaranteed to succeed.

Returns
  • this buffer.