C# Class FiftyOne.Foundation.Mobile.Detection.Factories.StreamFactory

Factory class used to create a DataSet from a source data structure. All the entities are held in the persistent store and only loads into memory when required. A cache mechanisim is used to improve efficiency as many entities are frequently used in a high volume environment.

The data set will be initialised very quickly as only the header information is read. Entities are then created when requested by the detection process and stored in a cache to avoid being recreated if their requested again after a short period of time.

A dataset can be created in several ways: Using a data file: DataSet dataSet = StreamFactory.Create("path_to_file", false);

Where the boolean flag indicates if the data file should or should not be deleted when close() is invoked.

Using a byte array: DataSet dataSet = StreamFactory.Create(dataFileAsByteArray);

Where the byte array is the 51Degrees device data file read into a byte array.

For more information see https://51degrees.com/Support/Documentation/Net

The very small data structures , Properties and Components are always stored in memory as there is no benefit retrieving them every time they're needed.
Datei anzeigen Open project: 51Degrees/dotNET-Device-Detection

Public Methods

Method Description
Create ( byte array ) : DataSet

Creates a new DataSet from the byte array.

Create ( string filePath ) : DataSet

Creates a new DataSet from the file provided. The last modified date of the data set is the last write time of the data file provided.

Create ( string filePath, System.DateTime lastModified ) : DataSet

Creates a new DataSet from the file provided.

Create ( string filePath, System.DateTime lastModified, bool isTempFile ) : DataSet

Creates a new DataSet from the file provided.

Create ( string filePath, bool isTempFile ) : DataSet

Creates a new DataSet from the file provided. The last modified date of the data set is the last write time of th data file provided.

Private Methods

Method Description
Load ( DataSet dataSet ) : void

Initialises the dataset DataSet using the source of the data set.

Method Details

Create() public static method

Creates a new DataSet from the byte array.
public static Create ( byte array ) : DataSet
array byte Array of bytes to build the data set from ///
return FiftyOne.Foundation.Mobile.Detection.Entities.Stream.DataSet

Create() public static method

Creates a new DataSet from the file provided. The last modified date of the data set is the last write time of the data file provided.
public static Create ( string filePath ) : DataSet
filePath string Uncompressed file containing the data for /// the data set
return FiftyOne.Foundation.Mobile.Detection.Entities.Stream.DataSet

Create() public static method

Creates a new DataSet from the file provided.
public static Create ( string filePath, System.DateTime lastModified ) : DataSet
filePath string Uncompressed file containing the data for /// the data set
lastModified System.DateTime Date and time the source data was /// last modified.
return FiftyOne.Foundation.Mobile.Detection.Entities.Stream.DataSet

Create() public static method

Creates a new DataSet from the file provided.
public static Create ( string filePath, System.DateTime lastModified, bool isTempFile ) : DataSet
filePath string Uncompressed file containing the data for /// the data set
lastModified System.DateTime Date and time the source data was last /// modified.
isTempFile bool True if the file should be deleted when /// the source is disposed
return FiftyOne.Foundation.Mobile.Detection.Entities.Stream.DataSet

Create() public static method

Creates a new DataSet from the file provided. The last modified date of the data set is the last write time of th data file provided.
public static Create ( string filePath, bool isTempFile ) : DataSet
filePath string Uncompressed file containing the data for /// the data set
isTempFile bool True if the file should be deleted when /// the source is disposed
return FiftyOne.Foundation.Mobile.Detection.Entities.Stream.DataSet