private void Init(string fileName) { _fileName = fileName; FileStream stream = new FileStream(fileName, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.Read, 256); if (_cachingStrategy != null) { _storage = new CachedStream(stream, _cachingStrategy); } else { _storage = new CachedStream(stream, 1 << 18); } _writer = new BinaryWriter(_storage); _reader = new BinaryReader(_storage); _firstByteNodes = new TrieNode[256]; for (int i = 0; i < 256; ++i) { TrieNode node = new TrieNode(); _isTrieComplete = LoadNode(node); if (!_isTrieComplete) { node._byte = (byte)i; node.Parent = 0; node.IsToken = false; SaveNode(node); Flush(); } _firstByteNodes[i] = node; } _stringCache = new ObjectCache(_stringCachesize); _nodesCache = new IntObjectCache(_nodesCacheSize); _nodesCache.ObjectRemoved += _nodesCache_ObjectRemoved; _isDirty = false; }
public IntObjectCacheEnumerator(IntObjectCache cache) { _cache = cache; _cacheArray = cache._cache; Reset(); }