上一篇:WEBUS2.0 In Action - 开始搜索 | 下一篇:WEBUS2.0 In Action - 解析索引文件结构(2)
WEBUS的索引数据全部保存在一种抽象的目录结构中,它既支持实际物理目录,也支持以流(System.IO.Stream)作为数据载体的逻辑目录:
为了实现这个功能,WEBUS2.0 SDK在 Webus.IO 命名空间中提供了三个实用工具类:
Webus.IO.PhysicalDirectory - 物理目录
物理目录,不言而喻,十分简单。实现了Webus.IO.IDirectory的所有功能,能够在当前文件系统中创建目录,创建文件等等。其实质就是对普通目录操作的一种封装。
Webus.IO.LogicDirectory - 逻辑目录
逻辑目录是WEBUS中提供的一种全新的数据存储方式。它能够将一个流(System.IO.Stream)虚拟成一个逻辑目录,并在这个“目录”中创建、删除、修改逻辑文件流(Webus.IO.LogicStream)。
Webus.IO.LogicStream - 逻辑流
System.IO.Stream的子类,利用此类我们可以在逻辑目录中对逻辑文件进行流式操作。
OK废话少说,让我们看看在代码中如何应用:
![](http://write.blog.csdn.net/Images/OutliningIndicators/None.gif)
![](http://write.blog.csdn.net/Images/OutliningIndicators/None.gif)
![](http://write.blog.csdn.net/Images/OutliningIndicators/None.gif)
![](http://write.blog.csdn.net/Images/OutliningIndicators/None.gif)
![](http://write.blog.csdn.net/Images/OutliningIndicators/ExpandedBlockStart.gif)
![](http://write.blog.csdn.net/Images/OutliningIndicators/ContractedBlock.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/b854634c0904529d4018c4c3336be836.gif)
![](http://write.blog.csdn.net/Images/OutliningIndicators/InBlock.gif)
![](http://write.blog.csdn.net/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://write.blog.csdn.net/Images/OutliningIndicators/ContractedSubBlock.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/b854634c0904529d4018c4c3336be836.gif)
![](http://write.blog.csdn.net/Images/OutliningIndicators/InBlock.gif)
![](http://write.blog.csdn.net/Images/OutliningIndicators/InBlock.gif)
![](http://write.blog.csdn.net/Images/OutliningIndicators/InBlock.gif)
![](http://write.blog.csdn.net/Images/OutliningIndicators/InBlock.gif)
![](http://write.blog.csdn.net/Images/OutliningIndicators/InBlock.gif)
![](http://write.blog.csdn.net/Images/OutliningIndicators/InBlock.gif)
![](http://write.blog.csdn.net/Images/OutliningIndicators/InBlock.gif)
![](http://write.blog.csdn.net/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
![](http://write.blog.csdn.net/Images/OutliningIndicators/InBlock.gif)
![](http://write.blog.csdn.net/Images/OutliningIndicators/InBlock.gif)
![](http://write.blog.csdn.net/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://write.blog.csdn.net/Images/OutliningIndicators/ContractedSubBlock.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/b854634c0904529d4018c4c3336be836.gif)
![](http://write.blog.csdn.net/Images/OutliningIndicators/InBlock.gif)
![](http://write.blog.csdn.net/Images/OutliningIndicators/InBlock.gif)
![](http://write.blog.csdn.net/Images/OutliningIndicators/InBlock.gif)
![](http://write.blog.csdn.net/Images/OutliningIndicators/InBlock.gif)
![](http://write.blog.csdn.net/Images/OutliningIndicators/InBlock.gif)
![](http://write.blog.csdn.net/Images/OutliningIndicators/InBlock.gif)
![](http://write.blog.csdn.net/Images/OutliningIndicators/InBlock.gif)
![](http://write.blog.csdn.net/Images/OutliningIndicators/InBlock.gif)
![](http://write.blog.csdn.net/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
![](http://write.blog.csdn.net/Images/OutliningIndicators/InBlock.gif)
![](http://write.blog.csdn.net/Images/OutliningIndicators/InBlock.gif)
![](http://write.blog.csdn.net/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://write.blog.csdn.net/Images/OutliningIndicators/ContractedSubBlock.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/b854634c0904529d4018c4c3336be836.gif)
![](http://write.blog.csdn.net/Images/OutliningIndicators/InBlock.gif)
![](http://write.blog.csdn.net/Images/OutliningIndicators/InBlock.gif)
![](http://write.blog.csdn.net/Images/OutliningIndicators/InBlock.gif)
![](http://write.blog.csdn.net/Images/OutliningIndicators/InBlock.gif)
![](http://write.blog.csdn.net/Images/OutliningIndicators/InBlock.gif)
![](http://write.blog.csdn.net/Images/OutliningIndicators/InBlock.gif)
![](http://write.blog.csdn.net/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
![](http://write.blog.csdn.net/Images/OutliningIndicators/InBlock.gif)
![](http://write.blog.csdn.net/Images/OutliningIndicators/InBlock.gif)
![](http://write.blog.csdn.net/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://write.blog.csdn.net/Images/OutliningIndicators/ContractedSubBlock.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/b854634c0904529d4018c4c3336be836.gif)
![](http://write.blog.csdn.net/Images/OutliningIndicators/InBlock.gif)
![](http://write.blog.csdn.net/Images/OutliningIndicators/InBlock.gif)
![](http://write.blog.csdn.net/Images/OutliningIndicators/InBlock.gif)
![](http://write.blog.csdn.net/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
![](http://write.blog.csdn.net/Images/OutliningIndicators/ExpandedBlockEnd.gif)
有了这三个类的支持,我们就能够将多个文件集中到一个文件中,从而减少了物理文件数量,节省了操作系统的资源消耗(同时能够打开的文件句柄是有数量限制的),同时由于IO操作更加集中,对文件缓存的利用率将得到提高,进而会提升文件的读写性能。
相关信息及WEBUS2.0 SDK下载: 继续我的代码,分享我的快乐 - WEBUS2.0