voldemort.store.readonly.io
Class MappedFileReader

java.lang.Object
  extended by voldemort.store.readonly.io.BaseMappedFile
      extended by voldemort.store.readonly.io.MappedFileReader
All Implemented Interfaces:
java.io.Closeable

public class MappedFileReader
extends BaseMappedFile
implements java.io.Closeable

Facade around a MappedByteBuffer but we also support mlock on the mapped pages, and closing all dependent resources.


Field Summary
protected  java.io.FileInputStream in
           
protected  java.nio.MappedByteBuffer mappedByteBuffer
           
 
Fields inherited from class voldemort.store.readonly.io.BaseMappedFile
channel, closer, fadvise, fd, file, length, offset
 
Constructor Summary
MappedFileReader(java.io.File file)
           
MappedFileReader(java.lang.String path)
           
 
Method Summary
 void close()
           
 java.nio.MappedByteBuffer map(boolean setAutoLock)
          Read from this mapped file.
 
Methods inherited from class voldemort.store.readonly.io.BaseMappedFile
getFd, getFile, isClosed, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

in

protected java.io.FileInputStream in

mappedByteBuffer

protected java.nio.MappedByteBuffer mappedByteBuffer
Constructor Detail

MappedFileReader

public MappedFileReader(java.lang.String path)
                 throws java.io.IOException
Throws:
java.io.IOException

MappedFileReader

public MappedFileReader(java.io.File file)
                 throws java.io.IOException
Throws:
java.io.IOException
Method Detail

map

public java.nio.MappedByteBuffer map(boolean setAutoLock)
                              throws java.io.IOException
Read from this mapped file.

Throws:
java.io.IOException

close

public void close()
           throws java.io.IOException
Specified by:
close in interface java.io.Closeable
Throws:
java.io.IOException


Jay Kreps, Roshan Sumbaly, Alex Feinberg, Bhupesh Bansal, Lei Gao, Chinmay Soman, Vinoth Chandar, Zhongjie Wu