MappedByteBuffer.Force Method

Definition

Overloads

Force()

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

Force(Int32, Int32)

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

Force()

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

[Android.Runtime.Register("force", "()Ljava/nio/MappedByteBuffer;", "")]
public Java.Nio.MappedByteBuffer? Force ();
[<Android.Runtime.Register("force", "()Ljava/nio/MappedByteBuffer;", "")>]
member this.Force : unit -> Java.Nio.MappedByteBuffer

Returns

This buffer

Attributes

Remarks

Forces any changes made to this buffer's content to be written to the storage device containing the mapped file. The region starts at index zero in this buffer and is capacity() bytes.

If the file mapped into this buffer resides on a local storage device then when this method returns it is guaranteed that all changes made to the buffer since it was created, or since this method was last invoked, will have been written to that device.

If the file does not reside on a local device then no such guarantee is made.

If this buffer was not mapped in read/write mode (java.nio.channels.FileChannel.MapMode#READ_WRITE) then invoking this method may have no effect. In particular, the method has no effect for buffers mapped in read-only or private mapping modes. This method may or may not have an effect for implementation-specific mapping modes.

Java documentation for java.nio.MappedByteBuffer.force().

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.

Applies to

Force(Int32, Int32)

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

[Android.Runtime.Register("force", "(II)Ljava/nio/MappedByteBuffer;", "", ApiSince=35)]
public Java.Nio.MappedByteBuffer? Force (int index, int length);
[<Android.Runtime.Register("force", "(II)Ljava/nio/MappedByteBuffer;", "", ApiSince=35)>]
member this.Force : int * int -> Java.Nio.MappedByteBuffer

Parameters

index
Int32

The index of the first byte in the buffer region that is to be written back to storage; must be non-negative and less than capacity()

length
Int32

The length of the region in bytes; must be non-negative and no larger than capacity() - index

Returns

This buffer

Attributes

Remarks

Forces any changes made to a region of this buffer's content to be written to the storage device containing the mapped file. The region starts at the given index in this buffer and is length bytes.

If the file mapped into this buffer resides on a local storage device then when this method returns it is guaranteed that all changes made to the selected region buffer since it was created, or since this method was last invoked, will have been written to that device. The force operation is free to write bytes that lie outside the specified region, for example to ensure that data blocks of some device-specific granularity are transferred in their entirety.

If the file does not reside on a local device then no such guarantee is made.

If this buffer was not mapped in read/write mode (java.nio.channels.FileChannel.MapMode#READ_WRITE) then invoking this method may have no effect. In particular, the method has no effect for buffers mapped in read-only or private mapping modes. This method may or may not have an effect for implementation-specific mapping modes.

Added in 13.

Java documentation for java.nio.MappedByteBuffer.force(int, int).

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.

Applies to