Partager via


MappedByteBuffer Class

Definition

A direct byte buffer whose content is a memory-mapped region of a file.

[Android.Runtime.Register("java/nio/MappedByteBuffer", DoNotGenerateAcw=true)]
public abstract class MappedByteBuffer : Java.Nio.ByteBuffer
[<Android.Runtime.Register("java/nio/MappedByteBuffer", DoNotGenerateAcw=true)>]
type MappedByteBuffer = class
    inherit ByteBuffer
Inheritance
MappedByteBuffer
Attributes

Remarks

A direct byte buffer whose content is a memory-mapped region of a file.

Mapped byte buffers are created via the java.nio.channels.FileChannel#map FileChannel.map method. This class extends the ByteBuffer class with operations that are specific to memory-mapped file regions.

A mapped byte buffer and the file mapping that it represents remain valid until the buffer itself is garbage-collected.

The content of a mapped byte buffer can change at any time, for example if the content of the corresponding region of the mapped file is changed by this program or another. Whether or not such changes occur, and when they occur, is operating-system dependent and therefore unspecified.

"inaccess">

All or part of a mapped byte buffer may become inaccessible at any time, for example if the mapped file is truncated. An attempt to access an inaccessible region of a mapped byte buffer will not change the buffer's content and will cause an unspecified exception to be thrown either at the time of the access or at some later time. It is therefore strongly recommended that appropriate precautions be taken to avoid the manipulation of a mapped file by this program, or by a concurrently running program, except to read or write the file's content.

Mapped byte buffers otherwise behave no differently than ordinary direct byte buffers.

Added in 1.4.

Java documentation for java.nio.MappedByteBuffer.

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Constructors

MappedByteBuffer(IntPtr, JniHandleOwnership)

A constructor used when creating managed representations of JNI objects; called by the runtime.

Properties

Char

Returns the char at the current position and increases the position by 2.

(Inherited from ByteBuffer)
Class

Returns the runtime class of this Object.

(Inherited from Object)
Double

Returns the double at the current position and increases the position by 8.

(Inherited from ByteBuffer)
Float

Returns the float at the current position and increases the position by 4.

(Inherited from ByteBuffer)
Handle

The handle to the underlying Android instance.

(Inherited from Object)
HasArray

Tells whether or not this buffer is backed by an accessible byte array.

(Inherited from ByteBuffer)
HasRemaining

Tells whether there are any elements between the current position and the limit.

(Inherited from Buffer)
Int

Returns the int at the current position and increases the position by 4.

(Inherited from ByteBuffer)
IsDirect

Returns true if this is a direct buffer.

(Inherited from Buffer)
IsLoaded

Tells whether or not this buffer's content is resident in physical memory.

IsReadOnly

Indicates whether this buffer is read-only.

(Inherited from Buffer)
JniIdentityHashCode (Inherited from Object)
JniPeerMembers
Long

Returns the long at the current position and increases the position by 8.

(Inherited from ByteBuffer)
PeerReference (Inherited from Object)
Short

Returns the short at the current position and increases the position by 2.

(Inherited from ByteBuffer)
ThresholdClass

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

ThresholdType

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

Methods

AlignedSlice(Int32)

Creates a new byte buffer whose content is a shared and aligned subsequence of this buffer's content.

(Inherited from ByteBuffer)
AlignmentOffset(Int32, Int32)

Returns the memory address, pointing to the byte at the given index, modulus the given unit size.

(Inherited from ByteBuffer)
ArrayOffset()

Returns the offset within this buffer's backing array of the first element of the buffer&nbsp;&nbsp;(optional operation).

(Inherited from ByteBuffer)
AsCharBuffer()

Creates a view of this byte buffer as a char buffer.

(Inherited from ByteBuffer)
AsDoubleBuffer()

Creates a view of this byte buffer as a double buffer.

(Inherited from ByteBuffer)
AsFloatBuffer()

Creates a view of this byte buffer as a float buffer.

(Inherited from ByteBuffer)
AsIntBuffer()

Creates a view of this byte buffer as an int buffer.

(Inherited from ByteBuffer)
AsLongBuffer()

Creates a view of this byte buffer as a long buffer.

(Inherited from ByteBuffer)
AsReadOnlyBuffer()

Creates a new, read-only byte buffer that shares this buffer's content.

(Inherited from ByteBuffer)
AsShortBuffer()

Creates a view of this byte buffer as a short buffer.

(Inherited from ByteBuffer)
Capacity()

Returns this buffer's capacity.

(Inherited from Buffer)
Clear()

Clears this buffer.

(Inherited from Buffer)
Clone()

Creates and returns a copy of this object.

(Inherited from Object)
Compact()

Compacts this buffer&nbsp;&nbsp;(optional operation).

(Inherited from ByteBuffer)
CompareTo(ByteBuffer)

Compares this buffer to another.

(Inherited from ByteBuffer)
Dispose() (Inherited from Object)
Dispose(Boolean) (Inherited from Object)
Duplicate()

To be added

Duplicate()

Creates a new byte buffer that shares this buffer's content.

(Inherited from ByteBuffer)
Equals(Object)

Indicates whether some other object is "equal to" this one.

(Inherited from Object)
Flip()

Flips this buffer.

(Inherited from Buffer)
Force()

Forces any changes made to this buffer's content to be written to the storage device containing the mapped file.

ForceAsync()
Get()

Relative get method.

(Inherited from ByteBuffer)
Get(Byte[], Int32, Int32)

Relative bulk get method.

(Inherited from ByteBuffer)
Get(Byte[])

Relative bulk get method.

(Inherited from ByteBuffer)
Get(Int32)

Absolute get method.

(Inherited from ByteBuffer)
GetChar(Int32)

Absolute get method for reading a char value.

(Inherited from ByteBuffer)
GetDirectBufferAddress() (Inherited from Buffer)
GetDouble(Int32)

Absolute get method for reading a double value.

(Inherited from ByteBuffer)
GetFloat(Int32)

Absolute get method for reading a float value.

(Inherited from ByteBuffer)
GetHashCode()

Returns a hash code value for the object.

(Inherited from Object)
GetInt(Int32)

Absolute get method for reading an int value.

(Inherited from ByteBuffer)
GetLong(Int32)

Absolute get method for reading a long value.

(Inherited from ByteBuffer)
GetShort(Int32)

Absolute get method for reading a short value.

(Inherited from ByteBuffer)
JavaFinalize()

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.

(Inherited from Object)
Limit()

Returns this buffer's limit.

(Inherited from Buffer)
Limit(Int32)

Sets this buffer's limit.

(Inherited from Buffer)
Load()

Loads this buffer's content into physical memory.

LoadAsync()
Mark()

Sets this buffer's mark at its position.

(Inherited from Buffer)
Mismatch(ByteBuffer)

Finds and returns the relative index of the first mismatch between this buffer and a given buffer.

(Inherited from ByteBuffer)
Notify()

Wakes up a single thread that is waiting on this object's monitor.

(Inherited from Object)
NotifyAll()

Wakes up all threads that are waiting on this object's monitor.

(Inherited from Object)
Order()

Retrieves this buffer's byte order.

(Inherited from ByteBuffer)
Order(ByteOrder)

Modifies this buffer's byte order.

(Inherited from ByteBuffer)
Position()

Returns this buffer's position.

(Inherited from Buffer)
Position(Int32)

Sets this buffer's position.

(Inherited from Buffer)
Put(Byte[], Int32, Int32)

Relative bulk put method&nbsp;&nbsp;(optional operation).

(Inherited from ByteBuffer)
Put(Byte[])

Relative bulk put method&nbsp;&nbsp;(optional operation).

(Inherited from ByteBuffer)
Put(ByteBuffer)

Relative bulk put method&nbsp;&nbsp;(optional operation).

(Inherited from ByteBuffer)
Put(Int32, SByte)

Absolute put method&nbsp;&nbsp;(optional operation).

(Inherited from ByteBuffer)
Put(SByte)

Relative put method&nbsp;&nbsp;(optional operation).

(Inherited from ByteBuffer)
PutChar(Char)

Relative put method for writing a char value&nbsp;&nbsp;(optional operation).

(Inherited from ByteBuffer)
PutChar(Int32, Char)

Absolute put method for writing a char value&nbsp;&nbsp;(optional operation).

(Inherited from ByteBuffer)
PutDouble(Double)

Relative put method for writing a double value&nbsp;&nbsp;(optional operation).

(Inherited from ByteBuffer)
PutDouble(Int32, Double)

Absolute put method for writing a double value&nbsp;&nbsp;(optional operation).

(Inherited from ByteBuffer)
PutFloat(Int32, Single)

Absolute put method for writing a float value&nbsp;&nbsp;(optional operation).

(Inherited from ByteBuffer)
PutFloat(Single)

Relative put method for writing a float value&nbsp;&nbsp;(optional operation).

(Inherited from ByteBuffer)
PutInt(Int32, Int32)

Absolute put method for writing an int value&nbsp;&nbsp;(optional operation).

(Inherited from ByteBuffer)
PutInt(Int32)

Relative put method for writing an int value&nbsp;&nbsp;(optional operation).

(Inherited from ByteBuffer)
PutLong(Int32, Int64)

Absolute put method for writing a long value&nbsp;&nbsp;(optional operation).

(Inherited from ByteBuffer)
PutLong(Int64)

Relative put method for writing a long value&nbsp;&nbsp;(optional operation).

(Inherited from ByteBuffer)
PutShort(Int16)

Relative put method for writing a short value&nbsp;&nbsp;(optional operation).

(Inherited from ByteBuffer)
PutShort(Int32, Int16)

Absolute put method for writing a short value&nbsp;&nbsp;(optional operation).

(Inherited from ByteBuffer)
Remaining()

Returns the number of elements between the current position and the limit.

(Inherited from Buffer)
Reset()

Resets this buffer's position to the previously-marked position.

(Inherited from Buffer)
Rewind()

Rewinds this buffer.

(Inherited from Buffer)
SetHandle(IntPtr, JniHandleOwnership)

Sets the Handle property.

(Inherited from Object)
Slice()

To be added

Slice()

Creates a new byte buffer whose content is a shared subsequence of this buffer's content.

(Inherited from ByteBuffer)
Slice(Int32, Int32)

To be added

Slice(Int32, Int32)

Creates a new byte buffer whose content is a shared subsequence of this buffer's content.

(Inherited from ByteBuffer)
ToArray<T>() (Inherited from Object)
ToString()

Returns a string representation of the object.

(Inherited from Object)
UnregisterFromRuntime() (Inherited from Object)
Wait()

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>.

(Inherited from Object)
Wait(Int64, Int32)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)
Wait(Int64)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)

Explicit Interface Implementations

IComparable.CompareTo(Object) (Inherited from ByteBuffer)
IJavaPeerable.Disposed() (Inherited from Object)
IJavaPeerable.DisposeUnlessReferenced() (Inherited from Object)
IJavaPeerable.Finalized() (Inherited from Object)
IJavaPeerable.JniManagedPeerState (Inherited from Object)
IJavaPeerable.SetJniIdentityHashCode(Int32) (Inherited from Object)
IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates) (Inherited from Object)
IJavaPeerable.SetPeerReference(JniObjectReference) (Inherited from Object)

Extension Methods

JavaCast<TResult>(IJavaObject)

Performs an Android runtime-checked type conversion.

JavaCast<TResult>(IJavaObject)
GetJniTypeName(IJavaPeerable)

Applies to