in datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/BaseWritableMemoryImpl.java [116:136]
public static WritableMemory wrapMap(final File file, final long fileOffsetBytes,
final long capacityBytes, final boolean localReadOnly, final ByteOrder byteOrder) {
final AllocateDirectWritableMap dirWMap =
new AllocateDirectWritableMap(file, fileOffsetBytes, capacityBytes, localReadOnly);
final int typeId = (dirWMap.resourceReadOnly || localReadOnly) ? READONLY : 0;
final long cumOffsetBytes = dirWMap.nativeBaseOffset;
final BaseWritableMemoryImpl wmem = Util.isNativeByteOrder(byteOrder)
? new MapWritableMemoryImpl(
dirWMap,
0L,
capacityBytes,
typeId,
cumOffsetBytes)
: new MapNonNativeWritableMemoryImpl(
dirWMap,
0L,
capacityBytes,
typeId,
cumOffsetBytes);
return wmem;
}