FileChannel.Map(FileChannel+MapMode, Int64, Int64) 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
将此通道文件的某个区域直接映射到内存中。
[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
参数
- mode
- FileChannel.MapMode
根据文件是分别映射只读、读/写还是私下(复制写入)在类中MapMode#READ_ONLY READ_ONLY定义的常量MapMode#READ_WRITE READ_WRITEMapMode#PRIVATE
PRIVATEMapMode之一
- position
- Int64
要在其中启动映射区域的文件中的位置;必须为非负值
- size
- Int64
要映射的区域的大小;必须为非负值且不大于 java.lang.Integer#MAX_VALUE
返回
映射字节缓冲区
- 特性
例外
如果未打开 FileChannel 进行读取,但给定模式为“READ_ONLY”。
如果未打开 FileChannel 进行写入,但给定模式不是“READ_ONLY”。
如果给定的位置和大小参数不正确,则为 。
两者都必须为非负数。
size 也不得大于最大整数。
发生任何 I/O 错误时。
注解
Java文档java.nio.channels.FileChannel.map(java.nio.channels.MapMode, long, long)。
本页的某些部分是根据 创建和共享的工作进行的修改,并根据 许可证中所述的条款使用。