MailBee.NET Objects 7.2

BayesFilter.SaveDatabase Method (Stream, Stream, Int32, Boolean)

Compacts the database by removing non-significant data and saves the database to stream.

public void SaveDatabase(
   Stream spamStream,
   Stream nonSpamStream,
   int threshold,
   bool saveAlways
);

Parameters

spamStream
An output stream containing spam samples.
nonSpamStream
An output stream containing non-spam samples.
threshold
Specifies how many times (at least) the word should appear in the database to keep it from removal during compacting the database. If the word appears less times then specified, it will be considered non-significant and thus will be removed. If zero, no words will be removed from the database.
saveAlways
If true, the method will save the database even if has not been modified since it had been loaded to memory; if false, the method will save it only if it has been modified.

Remarks

The data format in the stream is the same that is used for files (and the method behaves identically to SaveDatabase with the only difference that streams are used instead of files).

Exceptions

Exception Type Condition
MailBeeInvalidArgumentException spamStream or nonSpamStream is a null reference (Nothing in Visual Basic).
MailBeeIOException An I/O error occurred.

See Also

BayesFilter Class | MailBee.AntiSpam Namespace | BayesFilter.SaveDatabase Overload List