public class Dataset extends Object implements Closeable
Dataset should not be constructed directly, instead use either
StreamFactory or
MemoryFactory. Stream factory
returns a Stream
Dataset which extends the this class and contains data members and methods
to access the data file on the "as needed" basis.
All information about the detector data set is exposed in this class including meta data and data used for device detection in the form of lists.
When you create a data set remember to close() it to release
resources and file locks.
For more information see https://51degrees.com/Support/Documentation/Java
| Modifier and Type | Field and Description |
|---|---|
int |
age
Age of the data in months when exported.
|
MemoryFixedList<Component> |
components
A list of all the components the data set contains.
|
String |
copyright
The copyright notice associated with the data set.
|
int |
copyrightOffset
The offset for the copyright notice associated with the data set.
|
int |
csvBufferLength
The number of bytes to allocate to a buffer returning CSV format data for
a match.
|
int |
deviceCombinations
The number of unique device combinations available in the data set.
|
Guid |
export
A unique Tag for the exported data.
|
String |
format
The name of the property map used to create the dataset.
|
int |
formatOffset
The offset for the name of the property map used to create the dataset.
|
byte |
highestCharacter
The highest character the character trees can contain.
|
int |
jsonBufferLength
The number of bytes to allocate to a buffer returning JSON format data
for a match.
|
Calendar |
lastModified
When the data was last modified.
|
byte |
lowestCharacter
The lowest character the character trees can contain.
|
MemoryFixedList<Map> |
maps
A list of all the maps the data set contains.
|
int |
maximumRank
The largest rank value that can be returned.
|
int |
maxSignatures
The maximum number of signatures that can be checked.
|
int |
maxSignaturesClosest
The maximum number of signatures that could possibly be returned during a
closest match.
|
short |
maxUserAgentLength
The maximum length of a User-Agent string.
|
short |
maxValues
The maximum number of values that can be returned by a profile and a
property supporting a list of values.
|
int |
minUserAgentCount
The minimum number of times a User-Agent should have been seen before it
was included in the dataset.
|
short |
minUserAgentLength
The minimum length of a User-Agent string.
|
Modes |
mode
The mode of operation the data set is using.
|
int |
nameOffset
The offset for the common name of the data set.
|
Date |
nextUpdate
The date the data set is next expected to be updated by 51Degrees.
|
IFixedList<IntegerEntity> |
nodeRankedSignatureIndexes
List of integers that represent ranked signature indexes.
|
IReadonlyList<Node> |
nodes
List of nodes the data set contains.
|
IReadonlyList<ProfileOffset> |
profileOffsets
List of profile offsets the data set contains.
|
IReadonlyList<Profile> |
profiles
A list of all the possible profiles the data set contains.
|
PropertiesList |
properties
A list of all properties the data set contains.
|
Date |
published
The date the data set was published.
|
IFixedList<IntegerEntity> |
rankedSignatureIndexes
A list of signature indexes ordered in ascending order of rank.
|
IReadonlyList<Node> |
rootNodes
Nodes for each of the possible character positions in the User-Agent.
|
IFixedList<IntegerEntity> |
signatureNodeOffsets
List of integers that represent signature node offsets.
|
int |
signatureNodesCount
The number of nodes each signature can contain.
|
int |
signatureProfilesCount
The number of profiles each signature can contain.
|
IReadonlyList<Signature> |
signatures
A list of all the signatures the data set contains.
|
IReadonlyList<AsciiString> |
strings
A list of ASCII byte arrays for strings used by the dataset.
|
Guid |
tag
A unique Tag for the data set.
|
IReadonlyList<Value> |
values
A list of all property values the data set contains.
|
Version |
version
The version of the data set.
|
DetectionConstants.FORMAT_VERSIONS |
versionEnum
The version of the data set as an Enumeration.
|
int |
xmlBufferLength
The number of bytes to allocate to a buffer returning XML format data for
a match.
|
| Constructor and Description |
|---|
Dataset(Date lastModified,
Modes mode)
Constructs a new data set ready to have lists of data assigned to it.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Disposes of the data set releasing any file locks.
|
Profile |
findProfile(int profileId)
Searches the list of profile IDs and returns the profile if the profile
id is valid.
|
Property |
get(String propertyName)
Method searches for a property with the given name and returns one if
found.
|
long |
getAge()
Returns time that has elapsed since the data in the data set was current.
|
Component |
getBrowsers()
|
Component |
getComponent(String componentName)
Retrieves
Component by name if a component with such name exists. |
IReadonlyList<Component> |
getComponents()
Returns an iterable of all
Components in the current
data file. |
String |
getCopyright()
The copyright notice associated with the data file.
|
Component |
getCrawlers()
Returns the crawler
Component that contains a set of
properties and profiles related to
crawlers (such as: IsCrawler property). |
boolean |
getDisposed()
Indicates if the data set has been disposed.
|
String |
getFormat()
Major version of the data file backing the this data set.
|
Component |
getHardware()
Returns the hardware
Component that contains a set of
properties and profiles related to
hardware (such as: IsCrawler property). |
String[] |
getHttpHeaders()
Creates a list of HTTP headers if one does not already exist.
|
IReadonlyList<Map> |
getMaps()
Returns an iterable list of maps contained within the data file.
|
int |
getMaximumRank()
The largest rank value that can be returned.
|
short |
getMinUserAgentLength()
The minimum length of a User-Agent string.
|
String |
getName()
The common name of the data set such as 'Lite', 'Premium' and
'Enterprise'.
|
long |
getNodeCacheSwitches()
Deprecated.
|
IFixedList<IntegerEntity> |
getNodeRankedSignatureIndexes()
Returns a list of integers that represent ranked signature indexes.
|
IReadonlyList<Node> |
getNodes()
List of nodes the data set contains.
|
int |
getNodesCount()
Returns the number of nodes each signature can contain.
|
double |
getPercentageNodeCacheMisses()
The percentage of requests for nodes which were not already
contained in the cache.
|
double |
getPercentageProfilesCacheMisses()
The percentage of requests for profiles which were not already contained
in the cache.
|
double |
getPercentageRankedSignatureCacheMisses()
Deprecated.
|
double |
getPercentageSignatureCacheMisses()
The percentage of requests for signatures which were not already
contained in the cache.
|
double |
getPercentageStringsCacheMisses()
The percentage of requests for strings which were not already contained
in the cache.
|
double |
getPercentageValuesCacheMisses()
The percentage of requests for values which were not already contained in
the cache.
|
IReadonlyList<Profile> |
getProfiles()
A list of all the possible
profiles contained in the
current data set. |
long |
getProfilesCacheSwitches()
Deprecated.
|
int |
getProfilesCount()
Returns the number of
profiles each signature can contain. |
IReadonlyList<Property> |
getProperties()
A list of all
properties the data set contains. |
Property |
getPropertyByName(String propertyName)
Deprecated.
|
long |
getRankedSignatureCacheSwitches()
Deprecated.
|
IFixedList<IntegerEntity> |
getRankedSignatureIndexes()
Returns a list of signature indexes ordered in ascending order of rank.
|
long |
getSignatureCacheSwitches()
Deprecated.
|
IFixedList<IntegerEntity> |
getSignatureNodeOffsets()
Returns a list of integers that represent signature node offsets.
|
IReadonlyList<Signature> |
getSignatures()
List of
signatures the data set contains. |
Component |
getSoftware()
|
long |
getStringsCacheSwitches()
Deprecated.
|
IReadonlyList<Value> |
getValues()
A list of all
values the data set contains. |
long |
getValuesCacheSwitches()
Deprecated.
|
void |
init()
Called after the entire data set has been loaded to ensure any further
initialisation steps that require other items in the data set can be
completed.
|
void |
initComponents()
Preloads components to speed retrieval later at the expense of memory.
|
void |
initNodes()
Preloads nodes to speed retrieval later at the expense of memory.
|
void |
initProfiles()
Preloads profiles to speed retrieval later at the expense of memory.
|
void |
initProperties()
Preloads properties to speed retrieval later at the expense of memory.
|
void |
initSignatures()
Preloads signatures to speed retrieval later at the expense of memory.
|
void |
initValues()
Preloads values to speed retrieval later at the expense of memory.
|
void |
resetCache()
If there are cached lists being used the states are reset for them.
|
public int age
public MemoryFixedList<Component> components
public volatile String copyright
public int copyrightOffset
public int csvBufferLength
public int deviceCombinations
public Guid export
public volatile String format
public int formatOffset
public byte highestCharacter
public int jsonBufferLength
public Calendar lastModified
public byte lowestCharacter
public MemoryFixedList<Map> maps
public int maxSignatures
public int maxSignaturesClosest
public short maxUserAgentLength
public short maxValues
public volatile int maximumRank
public int minUserAgentCount
public short minUserAgentLength
public final Modes mode
public int nameOffset
public Date nextUpdate
public IReadonlyList<Node> nodes
public IFixedList<IntegerEntity> nodeRankedSignatureIndexes
public IReadonlyList<Profile> profiles
public IReadonlyList<ProfileOffset> profileOffsets
public PropertiesList properties
public Date published
public IFixedList<IntegerEntity> rankedSignatureIndexes
public IReadonlyList<Node> rootNodes
public int signatureNodesCount
public IFixedList<IntegerEntity> signatureNodeOffsets
public int signatureProfilesCount
public IReadonlyList<Signature> signatures
public IReadonlyList<AsciiString> strings
public Guid tag
public IReadonlyList<Value> values
public Version version
public DetectionConstants.FORMAT_VERSIONS versionEnum
public int xmlBufferLength
public Dataset(Date lastModified, Modes mode) throws IOException
lastModified - The date and time the source of the data was
last modified.mode - The mode of operation the data set will be using.IOException - signals an I/O exception occurredpublic long getAge()
public double getPercentageSignatureCacheMisses()
public double getPercentageNodeCacheMisses()
public double getPercentageStringsCacheMisses()
public double getPercentageProfilesCacheMisses()
public double getPercentageValuesCacheMisses()
public int getMaximumRank()
public boolean getDisposed()
public Component getHardware() throws IOException
Component that contains a set of
properties and profiles related to
hardware (such as: IsCrawler property).
Note that for the 'Lite' data file this component returns only three properties: IsMobile, ScreenPixelsWidth and ScreenPixelsHeight.
Premium and Enterprise data files contain considerably more data, meaning more accurate detections and access to properties like DeviceType, IsTablet, DeviceRAM, HardwareName, PriceBand, ScreenInchesWidth and more. Compare data options.
For more information see: 51Degrees Pattern Data Model
IOException - signals an I/O exception occurredpublic Component getSoftware() throws IOException
Component that contains a set of
properties and profiles related to
software. Software component includes properties like: PlatformName and
PlatformVersion.
Premium and Enterprise data files contain considerably more data, meaning more accurate detections and access to properties like PlatformVendor, CLDC and CcppAccept. Compare data options.
For more information see: 51Degrees Pattern Data Model
IOException - if there was a problem accessing data file.public Component getBrowsers() throws IOException
Component that contains a set of
properties and profiles related to
browsers.
Premium and Enterprise data files contain considerably more data, meaning more accurate detections and access to properties like AjaxRequestType, IsWebApp, HtmlVersion and Javascript. Compare data options.
For more information see: 51Degrees Pattern Data Model
Component.IOException - if there was a problem accessing data file.public Component getCrawlers() throws IOException
Component that contains a set of
properties and profiles related to
crawlers (such as: IsCrawler property).
Note that for the 'Lite' data file this component will not return any properties. Some profiles will be returned but no properties associated with this component will be available.
Premium and Enterprise data files contain considerably more data, meaning more accurate detections and access to the IsCrawler property. Compare data options.
For more information see: 51Degrees Pattern Data Model
IOException - signals an I/O exception has occurredpublic String getCopyright() throws IOException
IOException - if there was a problem accessing data file.public String getName() throws IOException
IOException - if there was a problem accessing data file.public String getFormat() throws IOException
IOException - if there was a problem accessing data file.public IReadonlyList<Component> getComponents()
Components in the current
data file.
For more information see:
51Degrees Pattern Data ModelComponent entities in the current data file.public IReadonlyList<Map> getMaps()
public IReadonlyList<Property> getProperties()
properties the data set contains.public IReadonlyList<Value> getValues()
values the data set contains. A value is
the specific content of a Property for a specific Profile.
For example: IsMobile can have value 'True' for profile A but have a
value 'False' for profile B.public IReadonlyList<Signature> getSignatures()
signatures the data set contains. Signatures
contain one Profile per Component and rank values.
For more information see: 51Degrees Pattern Data Model
public IReadonlyList<Node> getNodes()
public IReadonlyList<Profile> getProfiles()
profiles contained in the
current data set. Profiles contain multiple values. Each
profile belongs to one Component and can be assigned to many
signatures.
For more information see: 51Degrees Pattern Data Model
public short getMinUserAgentLength()
public IFixedList<IntegerEntity> getSignatureNodeOffsets()
public IFixedList<IntegerEntity> getNodeRankedSignatureIndexes()
public String[] getHttpHeaders() throws IOException
IOException - if there was a problem accessing data file.public void init()
throws IOException
Do not use this method as it is part of the internal logic.
IOException - signals an I/O exception occurredpublic void initSignatures()
throws IOException
init() has already been
called.
This method should not be called as it is part of the internal logic.
IOException - if there was a problem accessing data file.public void initNodes()
throws IOException
init() has already been
called.
This method should not be called as it is part of the internal logic.
IOException - if there was a problem accessing data file.public void initProfiles()
throws IOException
init() has already been
called.
This method should not be called as it is part of the internal logic.
IOException - if there was a problem accessing data file.public void initComponents()
throws IOException
init() has already been
called.
This method should not be called as it is part of the internal logic.
IOException - if there was a problem accessing data file.public void initProperties()
throws IOException
init() has already been
called.
This method should not be called as it is part of the internal logic.
IOException - if there was a problem accessing data file.public void initValues()
throws IOException
init() has already been
called.
This method should not be called as it is part of the internal logic.
IOException - if there was a problem accessing data file.public Component getComponent(String componentName) throws IOException
Component by name if a component with such name exists.
Method can return null if no component with required name was found; use
a null check when invoking.
Component contains a list of Profile and Property
that are related to this component. For more information see:
51Degrees Pattern Data Model
componentName - name of the required Component as string.Component matching the name, or null.IOException - if there was a problem accessing data file.public Property get(String propertyName) throws IOException
propertyName - name of the property to find, should not be null.IOException - if there was a problem accessing data file.@Deprecated public Property getPropertyByName(String propertyName) throws IOException
propertyName - name of the property to find as a string.IOException - if there was a problem accessing data file.public int getProfilesCount()
profiles each signature can contain.
The number of profiles should be equal to the number of
components, in other words: each signature has one
profile per component.public int getNodesCount()
public Profile findProfile(int profileId) throws IOException
profileId - Id of the profile to be found, not negative.IOException - signals an I/O exception occurredpublic void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableIOException - if there was a problem accessing data file.@Deprecated public double getPercentageRankedSignatureCacheMisses()
@Deprecated public long getSignatureCacheSwitches()
@Deprecated public long getNodeCacheSwitches()
@Deprecated public long getStringsCacheSwitches()
@Deprecated public long getProfilesCacheSwitches()
@Deprecated public long getValuesCacheSwitches()
public IFixedList<IntegerEntity> getRankedSignatureIndexes()
@Deprecated public long getRankedSignatureCacheSwitches()
public void resetCache()
Copyright © 2015 51Degrees. All rights reserved.