Build 1.0_r1(from source)

java.nio
Class MappedByteBuffer

java.lang.Object
  extended by java.nio.Buffer
      extended by java.nio.ByteBuffer
          extended by java.nio.MappedByteBuffer
All Implemented Interfaces:
Comparable<ByteBuffer>
Direct Known Subclasses:
MappedByteBufferAdapter

public abstract class MappedByteBuffer
extends ByteBuffer

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.


Field Summary
(package private)  DirectByteBuffer wrapped
           
 
Fields inherited from class java.nio.ByteBuffer
order
 
Fields inherited from class java.nio.Buffer
_elementSizeShift, capacity, limit, mark, position, UNSET_MARK
 
Constructor Summary
MappedByteBuffer(ByteBuffer directBuffer)
           
MappedByteBuffer(org.apache.harmony.luni.platform.PlatformAddress addr, int capa, int offset, int mode)
           
 
Method Summary
 MappedByteBuffer force()
          Writes all changes of the buffer to the mapped file.
 boolean isLoaded()
          Returns true if this buffer's content is loaded.
 MappedByteBuffer load()
          Loads this buffer's content into memory.
 
Methods inherited from class java.nio.ByteBuffer
_array, _arrayOffset, allocate, allocateDirect, array, arrayOffset, asCharBuffer, asDoubleBuffer, asFloatBuffer, asIntBuffer, asLongBuffer, asReadOnlyBuffer, asShortBuffer, compact, compareTo, duplicate, equals, get, get, get, get, getChar, getChar, getDouble, getDouble, getFloat, getFloat, getInt, getInt, getLong, getLong, getShort, getShort, hasArray, hashCode, isDirect, order, order, orderImpl, protectedArray, protectedArrayOffset, protectedHasArray, put, put, put, put, put, putChar, putChar, putDouble, putDouble, putFloat, putFloat, putInt, putInt, putLong, putLong, putShort, putShort, slice, toString, wrap, wrap
 
Methods inherited from class java.nio.Buffer
capacity, clear, flip, hasRemaining, isReadOnly, limit, limit, mark, position, position, remaining, reset, rewind
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

wrapped

final DirectByteBuffer wrapped
Constructor Detail

MappedByteBuffer

MappedByteBuffer(ByteBuffer directBuffer)

MappedByteBuffer

MappedByteBuffer(org.apache.harmony.luni.platform.PlatformAddress addr,
                 int capa,
                 int offset,
                 int mode)
Method Detail

isLoaded

public final boolean isLoaded()
Returns true if this buffer's content is loaded.

Returns:
True if this buffer's content is loaded.

load

public final MappedByteBuffer load()
Loads this buffer's content into memory.

Returns:
This buffer

force

public final MappedByteBuffer force()
Writes all changes of the buffer to the mapped file. All changes must be written by invoking this method if the mapped file exists on the local device, otherwise the action can not be specified.

Returns:
This buffer

Build 1.0_r1(from source)

Please submit a feedback, bug or feature