add use stream method

This commit is contained in:
stulzq 2018-08-19 16:47:01 +08:00
parent b7e9755c6b
commit f3ae83afb5
1 changed files with 13 additions and 1 deletions

View File

@ -23,7 +23,7 @@ namespace IP2Region
/// <summary> /// <summary>
/// db file access handler /// db file access handler
/// </summary> /// </summary>
private FileStream _raf = null; private Stream _raf = null;
/// <summary> /// <summary>
/// header blocks buffer /// header blocks buffer
@ -75,6 +75,18 @@ namespace IP2Region
public DbSearcher(string dbFile) : this(null, dbFile) { } public DbSearcher(string dbFile) : this(null, dbFile) { }
public DbSearcher(DbConfig dbConfig, Stream dbFileStream)
{
if (_dbConfig == null)
{
_dbConfig = dbConfig;
}
_raf = dbFileStream;
}
public DbSearcher(Stream dbFileStream) : this(null, dbFileStream) { }
#region Sync Methods #region Sync Methods
/// <summary> /// <summary>
/// Get the region with a int ip address with memory binary search algorithm. /// Get the region with a int ip address with memory binary search algorithm.