While translating a Java project to C#, i got stuck with the following piece:
RandomAccessFile raf = new RandomAccessFile(fileName, "r");
FileChannel channel = raf.getChannel();
MappedByteBuffer buffer = channel.map(FileChannel.MapMode.READ_ONLY, 0, length);
I'm not familiar with the memory mapping conception, I found a MemoryMappedFile
class in C#, but don't know how to use it properly like in the Java code above (the MappedByteBuffer
is used to obtain a large binary file, about 600-700MB).
Can anyone tell me how to translate the piece above properly?
A MemoryMappedViewStream is a thin veneer onto the memory.