本文整理汇总了Java中org.apache.cassandra.io.util.MappedFileDataInput类的典型用法代码示例。如果您正苦于以下问题:Java MappedFileDataInput类的具体用法?Java MappedFileDataInput怎么用?Java MappedFileDataInput使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MappedFileDataInput类属于org.apache.cassandra.io.util包,在下文中一共展示了MappedFileDataInput类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getSegment
import org.apache.cassandra.io.util.MappedFileDataInput; //导入依赖的package包/类
/**
* @return The segment containing the given position: must be closed after use.
*/
public FileDataInput getSegment(long position) {
Segment segment = floor(position);
if (segment.right != null) {
// segment is mmap'd
return new MappedFileDataInput(segment.right, path, segment.left, (int) (position - segment.left));
}
// not mmap'd: open a braf covering the segment
// FIXME: brafs are unbounded, so this segment will cover the rest of the file, rather than just the row
RandomAccessReader file = RandomAccessReader.open(new Path(path), fs);
file.seek(position);
return file;
}