語言

FileChannel.Map(FileChannel+MapMode, Int64, Int64) 方法

定義

將此通道檔案的某個區域直接映射到記憶體中。

[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_WRITE、 MapMode#PRIVATE PRIVATE或 MapMode ,分別取決於檔案是要映射為唯讀、讀寫或私有(寫時複製)

position
Int64

映射區域在檔案中起始的位置;必須是非負數

size
Int64

待繪製區域的規模;必須非負且不大於 java.lang.Integer#MAX_VALUE

傳回

映射位元組緩衝區

屬性

例外狀況

如果檔案通道未開啟讀取,但給定模式為「READ_ONLY」。

如果檔案通道未開啟寫入,但該模式並非「READ_ONLY」。

如果給定的位置和大小參數不正確。 兩者都必須是非負數。 size 而且不能大於最大整數。

如果發生任何 I/O 錯誤。

備註

Java 文件 java.nio.channels.FileChannel.map(java.nio.channels.MapMode, long, long)。

本頁部分內容為基於 Open Source Project 所創建與分享的作品,並依授權條款所描述的使用進行修改。

適用於