Package com.indeed.util.mmap
Class MMapBuffer
- java.lang.Object
-
- com.indeed.util.mmap.MMapBuffer
-
- All Implemented Interfaces:
BufferResource,java.io.Closeable,java.lang.AutoCloseable
public final class MMapBuffer extends java.lang.Object implements BufferResource
-
-
Field Summary
Fields Modifier and Type Field Description static intPAGE_SIZE
-
Constructor Summary
Constructors Constructor Description MMapBuffer(java.io.File file, long offset, long length, java.nio.channels.FileChannel.MapMode mapMode, java.nio.ByteOrder order)MMapBuffer(java.io.File file, java.nio.channels.FileChannel.MapMode mapMode, java.nio.ByteOrder order)MMapBuffer(java.io.RandomAccessFile raf, java.io.File file, long offset, long length, java.nio.channels.FileChannel.MapMode mapMode, java.nio.ByteOrder order)MMapBuffer(java.io.RandomAccessFile raf, java.io.File file, long offset, long length, java.nio.channels.FileChannel.MapMode mapMode, java.nio.ByteOrder order, boolean closeFile)MMapBuffer(java.io.RandomAccessFile raf, java.nio.file.Path path, long offset, long length, java.nio.channels.FileChannel.MapMode mapMode, java.nio.ByteOrder order)MMapBuffer(java.io.RandomAccessFile raf, java.nio.file.Path path, long offset, long length, java.nio.channels.FileChannel.MapMode mapMode, java.nio.ByteOrder order, boolean closeFile)MMapBuffer(java.nio.file.Path path, long offset, long length, java.nio.channels.FileChannel.MapMode mapMode, java.nio.ByteOrder order)MMapBuffer(java.nio.file.Path path, java.nio.channels.FileChannel.MapMode mapMode, java.nio.ByteOrder order)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidadvise(long position, long length)voidclose()static booleanisTrackingEnabled()Deprecated.static voidmadviseDontNeedTrackedBuffers()Deprecated.DirectMemorymemory()voidmincore(long position, long length, DirectMemory direct)voidmlock(long position, long length)voidmunlock(long position, long length)voidsync(long position, long length)
-
-
-
Field Detail
-
PAGE_SIZE
public static final int PAGE_SIZE
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
MMapBuffer
public MMapBuffer(java.io.File file, java.nio.channels.FileChannel.MapMode mapMode, java.nio.ByteOrder order) throws java.io.IOException- Throws:
java.io.IOException
-
MMapBuffer
public MMapBuffer(java.io.File file, long offset, long length, java.nio.channels.FileChannel.MapMode mapMode, java.nio.ByteOrder order) throws java.io.IOException- Throws:
java.io.IOException
-
MMapBuffer
public MMapBuffer(java.nio.file.Path path, java.nio.channels.FileChannel.MapMode mapMode, java.nio.ByteOrder order) throws java.io.IOException- Throws:
java.io.IOException
-
MMapBuffer
public MMapBuffer(java.nio.file.Path path, long offset, long length, java.nio.channels.FileChannel.MapMode mapMode, java.nio.ByteOrder order) throws java.io.IOException- Throws:
java.io.IOException
-
MMapBuffer
public MMapBuffer(java.io.RandomAccessFile raf, java.io.File file, long offset, long length, java.nio.channels.FileChannel.MapMode mapMode, java.nio.ByteOrder order) throws java.io.IOException- Throws:
java.io.IOException
-
MMapBuffer
public MMapBuffer(java.io.RandomAccessFile raf, java.nio.file.Path path, long offset, long length, java.nio.channels.FileChannel.MapMode mapMode, java.nio.ByteOrder order) throws java.io.IOException- Throws:
java.io.IOException
-
MMapBuffer
public MMapBuffer(java.io.RandomAccessFile raf, java.io.File file, long offset, long length, java.nio.channels.FileChannel.MapMode mapMode, java.nio.ByteOrder order, boolean closeFile) throws java.io.IOException- Throws:
java.io.IOException
-
MMapBuffer
public MMapBuffer(java.io.RandomAccessFile raf, java.nio.file.Path path, long offset, long length, java.nio.channels.FileChannel.MapMode mapMode, java.nio.ByteOrder order, boolean closeFile) throws java.io.IOException- Throws:
java.io.IOException
-
-
Method Detail
-
advise
public void advise(long position, long length) throws java.io.IOException- Throws:
java.io.IOException
-
sync
public void sync(long position, long length) throws java.io.IOException- Throws:
java.io.IOException
-
mlock
public void mlock(long position, long length)
-
munlock
public void munlock(long position, long length)
-
mincore
public void mincore(long position, long length, DirectMemory direct)
-
close
public void close() throws java.io.IOException- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Throws:
java.io.IOException
-
memory
public DirectMemory memory()
- Specified by:
memoryin interfaceBufferResource
-
isTrackingEnabled
@Deprecated public static boolean isTrackingEnabled()
Deprecated.- Returns:
- true, if open buffers tracking is enabled, else false
DO NOT USE THIS unless you know what you're doing.
-
madviseDontNeedTrackedBuffers
@Deprecated public static void madviseDontNeedTrackedBuffers()
Deprecated.If open buffers tracking is enabled, calls madvise with MADV_DONTNEED for all tracked buffers. If open buffers tracking is disabled, does nothing.This can reduce resident set size of the process, but may significantly affect performance. See madvise(2) for more info.
DO NOT USE THIS unless you know what you're doing.
-
-