Package one.nio.mem
Class MappedFile
- java.lang.Object
-
- one.nio.mem.MappedFile
-
- All Implemented Interfaces:
Closeable,AutoCloseable
public class MappedFile extends Object implements Closeable
-
-
Constructor Summary
Constructors Constructor Description MappedFile(long size)MappedFile(String name, long size)MappedFile(String name, long size, int mode)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()DataStreamdataStream(ByteOrder order)longgetAddr()RandomAccessFilegetFile()intgetMode()longgetSize()voidmakeReadonly()static longmap(RandomAccessFile f, int mode, long start, long size)voidsync()static voidunmap(long start, long size)
-
-
-
Field Detail
-
MAP_RO
public static final int MAP_RO
- See Also:
- Constant Field Values
-
MAP_RW
public static final int MAP_RW
- See Also:
- Constant Field Values
-
MAP_PV
public static final int MAP_PV
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
MappedFile
public MappedFile(long size)
-
MappedFile
public MappedFile(String name, long size) throws IOException
- Throws:
IOException
-
MappedFile
public MappedFile(String name, long size, int mode) throws IOException
- Throws:
IOException
-
-
Method Detail
-
sync
public void sync() throws IOException- Throws:
IOException
-
makeReadonly
public void makeReadonly() throws IOException- Throws:
IOException
-
close
public void close()
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-
getFile
public final RandomAccessFile getFile()
-
getAddr
public final long getAddr()
-
getSize
public final long getSize()
-
getMode
public int getMode()
-
dataStream
public DataStream dataStream(ByteOrder order)
-
map
public static long map(RandomAccessFile f, int mode, long start, long size) throws IOException
- Throws:
IOException
-
unmap
public static void unmap(long start, long size)
-
-