public final class StreamFactory extends Object
All the entities are held in the persistent store and only loads into memory when required. A cache mechanism 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 loaded. 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.
The very small data structures RootNodes, Properties and Components are always stored in memory as there is no benefit retrieving them every time they're needed.
A dataset can be created in several ways:
Dataset ds = 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.
Dataset ds = StreamFactory.create(dataFileAsByteArray);
Where the byte array is the 51Degrees device data file read into a byte array.
| Constructor and Description |
|---|
StreamFactory() |
| Modifier and Type | Method and Description |
|---|---|
static Dataset |
create(byte[] data)
Constructor creates a new dataset from the supplied bytes array.
|
static Dataset |
create(String filePath,
boolean isTempFile)
Creates a new DataSet from the file provided.
|
static Dataset |
create(String filepath,
Date lastModified,
boolean isTempFile)
Constructor creates a new dataset from the supplied data file.
|
public static Dataset create(byte[] data) throws IOException
data - a byte array containing the data file.IOException - if there was a problem accessing data file.public static Dataset create(String filePath, boolean isTempFile) throws IOException
filePath - Uncompressed file containing the data for the data set.isTempFile - True if the file should be deleted when the source is
disposedIOException - if there was a problem accessing data file.public static Dataset create(String filepath, Date lastModified, boolean isTempFile) throws IOException
filepath - name of the file (with path to file) to load data from.lastModified - Date and time the source data was last modified.isTempFile - True if the file should be deleted when the source is
disposed.IOException - if there was a problem accessing data file.Copyright © 2015 51Degrees. All rights reserved.