本文整理汇总了C#中IFilter.Dispose方法的典型用法代码示例。如果您正苦于以下问题:C# IFilter.Dispose方法的具体用法?C# IFilter.Dispose怎么用?C# IFilter.Dispose使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IFilter
的用法示例。
在下文中一共展示了IFilter.Dispose方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Table
public Table(StorageState storageState, FileData fileData)
{
_storageState = storageState;
try
{
_fileData = fileData;
if (_storageState.Options.MaxBlockCacheSizePerTableFile > 0)
{
_blockCache = new LruCache<BlockHandle, Block>(_storageState.Options.MaxBlockCacheSizePerTableFile);
}
if (fileData.Size < Footer.EncodedLength)
throw new CorruptedDataException("File is too short to be an sstable");
var footer = new Footer();
using (var accessor = fileData.File.CreateAccessor(fileData.Size - Footer.EncodedLength, Footer.EncodedLength))
{
footer.DecodeFrom(accessor);
}
var readOptions = new ReadOptions
{
VerifyChecksums = _storageState.Options.ParanoidChecks
};
_indexBlock = new Block(_storageState.Options, readOptions, footer.IndexHandle, fileData);
_indexBlock.IncrementUsage();
if (_storageState.Options.FilterPolicy == null)
return; // we don't need any metadata
using (var metaBlock = new Block(_storageState.Options, readOptions, footer.MetaIndexHandle, fileData))
using (var iterator = metaBlock.CreateIterator(CaseInsensitiveComparator.Default))
{
var filterName = ("filter." + _storageState.Options.FilterPolicy.Name);
iterator.Seek(filterName);
if (iterator.IsValid && CaseInsensitiveComparator.Default.Compare(filterName, iterator.Key) == 0)
{
var handle = new BlockHandle();
using (var stream = iterator.CreateValueStream())
{
handle.DecodeFrom(stream);
}
var filterAccessor = _fileData.File.CreateAccessor(handle.Position, handle.Count);
try
{
_filter = _storageState.Options.FilterPolicy.CreateFilter(filterAccessor);
}
catch (Exception)
{
if (_filter == null)
filterAccessor.Dispose();
else
_filter.Dispose();
throw;
}
}
}
}
catch (Exception)
{
Dispose();
throw;
}
}