Udostępnij za pośrednictwem


FileChannel.Map(FileChannel+MapMode, Int64, Int64) Method

Definition

Maps a region of this channel's file directly into memory.

[Android.Runtime.Register("map", "(Ljava/nio/channels/FileChannel$MapMode;JJ)Ljava/nio/MappedByteBuffer;", "GetMap_Ljava_nio_channels_FileChannel_MapMode_JJHandler")]
public abstract Java.Nio.MappedByteBuffer? Map (Java.Nio.Channels.FileChannel.MapMode? mode, long position, long size);
[<Android.Runtime.Register("map", "(Ljava/nio/channels/FileChannel$MapMode;JJ)Ljava/nio/MappedByteBuffer;", "GetMap_Ljava_nio_channels_FileChannel_MapMode_JJHandler")>]
abstract member Map : Java.Nio.Channels.FileChannel.MapMode * int64 * int64 -> Java.Nio.MappedByteBuffer

Parameters

mode
FileChannel.MapMode

One of the constants MapMode#READ_ONLY READ_ONLY, MapMode#READ_WRITE READ_WRITE, or MapMode#PRIVATE PRIVATE defined in the MapMode class, according to whether the file is to be mapped read-only, read/write, or privately (copy-on-write), respectively

position
Int64

The position within the file at which the mapped region is to start; must be non-negative

size
Int64

The size of the region to be mapped; must be non-negative and no greater than java.lang.Integer#MAX_VALUE

Returns

The mapped byte buffer

Attributes

Exceptions

if the FileChannel is not opened for reading but the given mode is "READ_ONLY".

if the FileChannel is not opened for writing but the given mode is not "READ_ONLY".

if the given parameters of position and size are not correct. Both must be non negative. size also must not be bigger than max integer.

if any I/O error occurs.

Remarks

Java documentation for java.nio.channels.FileChannel.map(java.nio.channels.MapMode, long, long).

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