public class MappedFile extends Object implements Closeable, DirectMemoryRegion
Modifier and Type | Field and Description |
---|---|
static int |
MAP_RW |
Constructor and Description |
---|
MappedFile(File name,
long size) |
Modifier and Type | Method and Description |
---|---|
long |
address() |
void |
close() |
RandomAccessFile |
file()
Gets underlying random access file.
|
static long |
map(RandomAccessFile f,
int mode,
long start,
long size)
Maps the given region of the file.
|
long |
size() |
DirectMemoryRegion |
slice(long offset)
Gets a sub-region of this region starting from the given offset.
|
static void |
unmap(long addr,
long size)
Un-maps the given region of the file.
|
public static final int MAP_RW
public MappedFile(File name, long size) throws IOException
name
- File path.size
- Expected file size. If size is 0, the existing size will be used.IOException
- If failed to open the file or memory-map it.public final RandomAccessFile file()
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
IOException
public final long address()
address
in interface DirectMemoryRegion
public final long size()
size
in interface DirectMemoryRegion
public DirectMemoryRegion slice(long offset)
slice
in interface DirectMemoryRegion
offset
- Offset within this region.public static long map(RandomAccessFile f, int mode, long start, long size) throws IOException
f
- File to map.mode
- Mode to map.start
- Mapping start offset within the file.size
- Size of file to map.IOException
public static void unmap(long addr, long size)
addr
- Previously mapped address to un-map.size
- Size of the mapped file.
Follow @ApacheIgnite
Ignite Fabric : ver. 2.0.0 Release Date : April 30 2017